From 3a69900ec4dae0a769d5661fed078d49d7b1a350 Mon Sep 17 00:00:00 2001 From: benjamin <benjamin@le-filament.com> Date: Fri, 13 May 2022 14:37:38 +0200 Subject: [PATCH] =?UTF-8?q?[fix]=20wizard=20journal=20UR=20&=20F=C3=A9d?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- views/scop_cotisation_cg.xml | 4 ++-- wizard/scop_bordereau_payment_mode_wizard.py | 14 ++++++++----- wizard/scop_bordereau_refund_wizard.py | 16 +++++++------- wizard/scop_cotisation_cg_regul.py | 22 ++++++++++---------- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/views/scop_cotisation_cg.xml b/views/scop_cotisation_cg.xml index 1df5c47..8c0e1a0 100644 --- a/views/scop_cotisation_cg.xml +++ b/views/scop_cotisation_cg.xml @@ -66,11 +66,11 @@ <hr/> <button name="add_simul" class="btn btn-outline-info" style="margin-right: 20px; width: 250px;" type="object" string="Globale : CG, UR et Fédération" - attrs="{'invisible': [('state', '!=', 'new')]}" context="{'type_simul': 'all'}"/> + context="{'type_simul': 'all'}"/> <button name="add_simul" class="btn btn-outline-info" style="width: 250px;" type="object" string="CG Scop uniquement" - attrs="{'invisible': [('state', '!=', 'new')]}" context="{'type_simul': 'cgscop'}"/> + context="{'type_simul': 'cgscop'}"/> <field name="simul_ids" mode="tree"/> </page> </notebook> diff --git a/wizard/scop_bordereau_payment_mode_wizard.py b/wizard/scop_bordereau_payment_mode_wizard.py index 45efe0a..e82de50 100644 --- a/wizard/scop_bordereau_payment_mode_wizard.py +++ b/wizard/scop_bordereau_payment_mode_wizard.py @@ -40,13 +40,17 @@ class ScopBordereauChangePaymentMode(models.TransientModel): bordereau_id.invoice_ids.update({ 'payment_mode_id': self.payment_mode_id.id, }) - contrib_cg_journal = self.env.user.company_id.contribution_journal_id - contrib_ur_fede_journal = \ - self.env.user.company_id.contribution_ur_or_fede_journal_id + journal_ids = [ + self.env.user.company_id.contribution_journal_id.id, + self.env.user.company_id.journal_fede_com_id.id, + self.env.user.company_id.journal_fede_cae_id.id, + self.env.user.company_id.journal_ur_hdf_id.id, + self.env.user.company_id.journal_ur_med_id.id, + ] + move_line_ids = self.env['account.move.line'].search([ ('partner_id', '=', self.bordereau_id.partner_id.id), - ('journal_id', 'in', ( - contrib_cg_journal.id, contrib_ur_fede_journal.id)), + ('journal_id', 'in', journal_ids), ('full_reconcile_id', '=', False), ('balance', '!=', 0), ('account_id.reconcile', '=', True), diff --git a/wizard/scop_bordereau_refund_wizard.py b/wizard/scop_bordereau_refund_wizard.py index a400e38..35e9ebb 100644 --- a/wizard/scop_bordereau_refund_wizard.py +++ b/wizard/scop_bordereau_refund_wizard.py @@ -132,10 +132,10 @@ class ScopBordereauRefundWizard(models.TransientModel): # CREATE REFUND if partner_id.ur_id.id == ur_hdf: product_ur = self.env.user.company_id.contribution_hdf_id - # account_ur = self.env.user.company_id.receivable_account_ur_hdf_id + journal_ur = self.env.user.company_id.journal_ur_hdf_id else: # ur = ur_med product_ur = self.env.user.company_id.contribution_med_id - # account_ur = self.env.user.company_id.receivable_account_ur_med_id + journal_ur = self.env.user.company_id.journal_ur_med_id cotiz_type = { self.env.ref('cgscop_partner.riga_14397').id: @@ -147,20 +147,20 @@ class ScopBordereauRefundWizard(models.TransientModel): self.env.ref('cgscop_partner.riga_14398').id: [ self.env.user.company_id.contribution_fede_com_id, - self.env.user.company_id.contribution_ur_or_fede_journal_id, - # self.env.user.company_id.receivable_account_fede_com_id + self.env.user.company_id.journal_fede_com_id, + partner_id.property_account_receivable_id ], self.env.ref('cgscop_partner.cotiz_fede_cae').id: [ self.env.user.company_id.contribution_fede_cae_id, - self.env.user.company_id.contribution_ur_or_fede_journal_id, - # self.env.user.company_id.receivable_account_fede_cae_id + self.env.user.company_id.journal_fede_cae_id, + partner_id.property_account_receivable_id ], self.env.ref('cgscop_partner.riga_14399').id: [ product_ur, - self.env.user.company_id.contribution_ur_or_fede_journal_id, - # account_ur + journal_ur, + partner_id.property_account_receivable_id ], } product = cotiz_type.get(int(self.type_cotiz))[0] diff --git a/wizard/scop_cotisation_cg_regul.py b/wizard/scop_cotisation_cg_regul.py index 95417ee..9766ead 100644 --- a/wizard/scop_cotisation_cg_regul.py +++ b/wizard/scop_cotisation_cg_regul.py @@ -156,40 +156,40 @@ class ScopCotisationRegul(models.TransientModel): if partner_id.ur_id.id == ur_hdf: amount_ur = self.amount_ur_hdf product_ur = self.env.user.company_id.contribution_hdf_id - # account_ur = self.env.user.company_id.receivable_account_ur_hdf_id + journal_ur = self.env.user.company_id.journal_ur_hdf_id else: # ur = ur_med amount_ur = self.amount_ur_med product_ur = self.env.user.company_id.contribution_med_id - # account_ur = self.env.user.company_id.receivable_account_ur_med_id + journal_ur = self.env.user.company_id.journal_ur_med_id cotiz_type = { self.env.ref('cgscop_partner.riga_14397').id: [ self.amount_cg, - self.env.user.company_id.contribution_cg_id, - self.env.user.company_id.contribution_journal_id, - partner_id.property_account_receivable_id.id + self.env.user.company_id.contribution_cg_id, + self.env.user.company_id.contribution_journal_id, + partner_id.property_account_receivable_id.id ], self.env.ref('cgscop_partner.riga_14398').id: [ self.amount_fede_com, self.env.user.company_id.contribution_fede_com_id, - self.env.user.company_id.contribution_ur_or_fede_journal_id, - # self.env.user.company_id.receivable_account_fede_com_id + self.env.user.company_id.journal_fede_com_id, + partner_id.property_account_receivable_id.id ], self.env.ref('cgscop_partner.cotiz_fede_cae').id: [ self.amount_fede_cae, self.env.user.company_id.contribution_fede_cae_id, - self.env.user.company_id.contribution_ur_or_fede_journal_id, - # self.env.user.company_id.receivable_account_fede_cae_id + self.env.user.company_id.journal_fede_cae_id, + partner_id.property_account_receivable_id.id ], self.env.ref('cgscop_partner.riga_14399').id: [ amount_ur, product_ur, - self.env.user.company_id.contribution_ur_or_fede_journal_id, - # account_ur + journal_ur, + partner_id.property_account_receivable_id.id ], } -- GitLab