diff --git a/models/scop_bordereau_cg.py b/models/scop_bordereau_cg.py index 898be630849081f29c21377e28f86cf33f99636c..3f627cc3b6803317b196b7171e8d5c1922a8f372 100644 --- a/models/scop_bordereau_cg.py +++ b/models/scop_bordereau_cg.py @@ -933,8 +933,6 @@ class Bordereau(models.Model): self.env["scop.contribution.type"].browse(type_contribution).name ) - type_contrib_cae = self.env.ref("cgscop_partner.cotiz_fede_cae").id - for i in range(1, int(self.nb_quarter) + 1): cotiz_quarter = (4 - int(self.nb_quarter)) + i @@ -946,54 +944,52 @@ class Bordereau(models.Model): # Calcul prix price_unit = amount / 4 - # Specific CAE calculation : to be deleted when 2022 is generated - if type_contribution == type_contrib_cae: - Invoice.create( - { - "partner_id": partner.id, - "liasse_fiscale_id": liasse.id, - "move_type": type_invoice, - "year": self.year, - "is_contribution": True, - "type_contribution_id": type_contribution, - "ref": ( - "T" - + str(cotiz_quarter) - + " " - + self.year - + " - " - + type_contrib_name + Invoice.create( + { + "partner_id": partner.id, + "liasse_fiscale_id": liasse.id, + "move_type": type_invoice, + "year": self.year, + "is_contribution": True, + "type_contribution_id": type_contribution, + "ref": ( + "T" + + str(cotiz_quarter) + + " " + + self.year + + " - " + + type_contrib_name + ), + "journal_id": journal_id.id, + "state": "draft", + "payment_mode_id": payment_mode.id + if payment_mode + else partner.customer_payment_mode_id.id, + "mandate_id": mandate_id.id if mandate_id else False, + "partner_bank_id": mandate_id.partner_bank_id.id + if mandate_id + else False, + "invoice_date": self.date_cotisation, + "invoice_date_due": quarters[cotiz_quarter - 1], + "bordereau_id": self.id, + "amount_cg_calculated": amount, + "cotiz_quarter": str(cotiz_quarter), + "invoice_line_ids": [ + ( + 0, + None, + { + "product_id": product.id, + "account_id": product.property_account_income_id.id, + "tax_ids": [(6, 0, product.taxes_id.ids)], + "name": product.name + " T" + str(cotiz_quarter), + "price_unit": price_unit, + "price_subtotal": price_unit, + }, ), - "journal_id": journal_id.id, - "state": "draft", - "payment_mode_id": payment_mode.id - if payment_mode - else partner.customer_payment_mode_id.id, - "mandate_id": mandate_id.id if mandate_id else False, - "partner_bank_id": mandate_id.partner_bank_id.id - if mandate_id - else False, - "invoice_date": self.date_cotisation, - "invoice_date_due": quarters[cotiz_quarter - 1], - "bordereau_id": self.id, - "amount_cg_calculated": amount, - "cotiz_quarter": str(cotiz_quarter), - "invoice_line_ids": [ - ( - 0, - None, - { - "product_id": product.id, - "account_id": product.property_account_income_id.id, - "tax_ids": [(6, 0, product.taxes_id.ids)], - "name": product.name + " T" + str(cotiz_quarter), - "price_unit": price_unit, - "price_subtotal": price_unit, - }, - ), - ], - } - ) + ], + } + ) def update_bordereau_version( self,