From a9791466dd2117319e3e5b0a23ea5c93e8792a04 Mon Sep 17 00:00:00 2001 From: Remi <remi@le-filament.com> Date: Tue, 22 Oct 2019 10:03:54 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20champ=20dissolution=5Freason=5Fid=20dan?= =?UTF-8?q?s=20p=C3=A9riodes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/scop_period.py | 5 +++++ views/res_partner_cooperative.xml | 1 + wizard/scop_deces_wizard.py | 2 ++ wizard/scop_period_wizard.py | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/models/scop_period.py b/models/scop_period.py index 04c9365..8e9ddbd 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 81de19f..2695b35 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 992ffb3..f8861d9 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 f7fc9aa..8c8b69f 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, -- GitLab