diff --git a/models/scop_period.py b/models/scop_period.py index 04c93650fd7b587df6608d72aa7574c3e1b8c56a..8e9ddbd57ba49a23305d0abfa6eb116bd9491359 100644 --- a/models/scop_period.py +++ b/models/scop_period.py @@ -58,3 +58,8 @@ class ScopPeriod(models.Model): string='Code NAF', on_delete='restrict') cae = fields.Boolean("CAE") + dissolution_reason_id = fields.Many2one( + 'res.partner.dissolution.reason', + string="Motif Décés", + on_delete='restrict', + track_visibility='onchange') diff --git a/views/res_partner_cooperative.xml b/views/res_partner_cooperative.xml index 81de19fd7d50b5f541aa50d00ffc235067e8c051..2695b3556f3c6b2dfcc314e66b6370b5769ce267 100644 --- a/views/res_partner_cooperative.xml +++ b/views/res_partner_cooperative.xml @@ -554,6 +554,7 @@ <field name="start"/> <field name="end"/> <field name="end_reason"/> + <field name="dissolution_reason_id"/> <field name="comments"/> <field name="name"/> <field name="cooperative_form_id"/> diff --git a/wizard/scop_deces_wizard.py b/wizard/scop_deces_wizard.py index 992ffb3c0d169235c35f4fb1590db58fede6b74f..f8861d9c1e7a89babacf22e2dffd0e3dd642e191 100644 --- a/wizard/scop_deces_wizard.py +++ b/wizard/scop_deces_wizard.py @@ -46,6 +46,8 @@ class ScopDecesWizard(models.TransientModel): last_period.write({ 'end': period.end, 'end_reason': 'autr', + 'dissolution_reason_id': + period.dissolution_reason_id.id, 'comments': period.comments, }) else: diff --git a/wizard/scop_period_wizard.py b/wizard/scop_period_wizard.py index f7fc9aa088e8b75248da3af45df2cc80becb7243..8c8b69f9cf030f87306ca03b1356090f53739fae 100644 --- a/wizard/scop_period_wizard.py +++ b/wizard/scop_period_wizard.py @@ -174,7 +174,6 @@ class ScopPeiodWizard(models.TransientModel): if period.start >= previous_period.end: partner_values = { 'dissolution_date': False, - 'dissolution_reason_id': False, } else: raise ValidationError( @@ -202,6 +201,7 @@ class ScopPeiodWizard(models.TransientModel): values = { 'name': period.name, + 'dissolution_reason_id': False, 'cooperative_form_id': period.cooperative_form_id.id, 'partner_company_type_id': period.partner_company_type_id.id, 'siret': period.siret,