diff --git a/models/scop_bordereau_cg.py b/models/scop_bordereau_cg.py index 42ba1146b9944c5f78f24799c58a0cd533f8e2dd..4797e35fd97b793f461a6d6d372f58b33b04a946 100644 --- a/models/scop_bordereau_cg.py +++ b/models/scop_bordereau_cg.py @@ -130,6 +130,7 @@ class Bordereau(models.Model): string="Cotisation CG Scop", currency_field="company_currency_id", compute="_compute_amount_cg", + store=True ) amount_residual = fields.Monetary( string="Montant dû", @@ -236,7 +237,7 @@ class Bordereau(models.Model): for r in self: if r.liasse_fiscale_id: liasse = r.liasse_fiscale_id - r.ca = liasse.revenue_cgsubv + r.ca = liasse.L2052_FL r.va = r.base_cotisation_cg.get_va(liasse) r.net_results = ( liasse.L2053_HN if liasse.L2053_HN > 0 else liasse.L2051_DI @@ -290,6 +291,7 @@ class Bordereau(models.Model): for r in self: r.amount_total_cotiz = sum(r.invoice_ids.mapped("amount_total_signed")) + @api.depends("invoice_ids", "invoice_ids.amount_total_signed") def _compute_amount_cg(self): type_cotisation_cg = self.env.ref("cgscop_partner.riga_14397") for r in self: @@ -301,7 +303,7 @@ class Bordereau(models.Model): @api.depends("invoice_ids", "invoice_ids.amount_residual_signed") def _compute_amount_residual(self): for r in self: - r.amount_total_cotiz = sum(r.invoice_ids.mapped("amount_residual_signed")) + r.amount_residual = sum(r.invoice_ids.mapped("amount_residual_signed")) def _compute_recipient(self): tag_cotiz_id = self.env.company.tag_cotiz_id @@ -731,25 +733,26 @@ class Bordereau(models.Model): # Invoice cotiz Fede CAE # - if partner.cae: - product_fede_cae_id = self.company_id.contribution_fede_cae_id - journal_fede_cae_id = self.company_id.journal_fede_cae_id - type_cotisation_fede_cae = self.env.ref("cgscop_partner.cotiz_fede_cae").id - - if liasse: - amount_fede_cae = base_cotiz.round_to_closest_multiple( - liasse.contribution_cae, 4 - ) - else: - amount_fede_cae = self.env["scop.liasse.fiscale"].get_plancher_cotiz()[ - "fede_cae" - ] - self.create_contribution( - product=product_fede_cae_id, - type_contribution=type_cotisation_fede_cae, - amount=amount_fede_cae, - journal_id=journal_fede_cae_id, - ) + # TODO: décommenter et modifier après la validation des cotisations CAE + # if partner.cae: + # product_fede_cae_id = self.company_id.contribution_fede_cae_id + # journal_fede_cae_id = self.company_id.journal_fede_cae_id + # type_cotisation_fede_cae = self.env.ref("cgscop_partner.cotiz_fede_cae").id + + # if liasse: + # amount_fede_cae = base_cotiz.round_to_closest_multiple( + # liasse.contribution_cae, 4 + # ) + # else: + # amount_fede_cae = self.env["scop.liasse.fiscale"].get_plancher_cotiz()[ + # "fede_cae" + # ] + # self.create_contribution( + # product=product_fede_cae_id, + # type_contribution=type_cotisation_fede_cae, + # amount=amount_fede_cae, + # journal_id=journal_fede_cae_id, + # ) # Invoice cotiz UR HDF # diff --git a/models/scop_cotisation_cg.py b/models/scop_cotisation_cg.py index 9c525965973d958ff6cb967a1097eae96bb39215..01eb9e8c863bcea1275b3328c256a77147065a98 100644 --- a/models/scop_cotisation_cg.py +++ b/models/scop_cotisation_cg.py @@ -491,11 +491,14 @@ class ScopCotisation(models.Model): "Montant Assiette", "Année Liasse", "Durée Exercice", + "CA (L2052 FL)", "CA sens CG Scop", "VABDF sens CG Scop", + "Masse Salariale (L2052 FY)", "Salaires sens CG Scop", "Résultat", "Dernier effectif connu", + "Dernier effectif associé connu", "Moyen de paiement", ] @@ -533,7 +536,7 @@ class ScopCotisation(models.Model): ) # Construction Tableau - liasse.read(["revenue_cg", "av_cg", "wage_cg"]) + liasse.read(["L2052_FL", "revenue_cg", "av_cg", "L2052_FY", "wage_cg"]) datas_contrib = [ m.member_number, m.ur_id.name, @@ -546,11 +549,14 @@ class ScopCotisation(models.Model): liasse.contribution_base_amount, liasse.year, liasse.dureeExercice, + liasse.L2052_FL, liasse.revenue_cg, liasse.av_cg, + liasse.L2052_FY, liasse.wage_cg, net_results, m.staff_last, + m.staff_shareholder_last, m.customer_payment_mode_id.name if m.customer_payment_mode_id else "Virement/Chèque", @@ -692,8 +698,8 @@ class ScopCotisation(models.Model): worksheet1.set_column(4, 4, 25, None) worksheet1.set_column(5, 6, 20, format_monetary) worksheet1.set_column(8, 8, 20, format_monetary) - worksheet1.set_column(11, 14, 20, format_monetary) - worksheet1.set_column(16, 16, 20, None) + worksheet1.set_column(11, 16, 20, format_monetary) + worksheet1.set_column(19, 19, 20, None) # Enregistrement du fichier dans la base workbook.close() @@ -738,7 +744,7 @@ class ScopCotisation(models.Model): ("is_qualified", "=", True), "|", "|", - ("revenue_cgsubv", ">", 0), + ("L2052_FL", ">", 0), ("av_lf", ">", 0), ("av_cg", ">", 0), ], diff --git a/models/scop_liasse_fiscale.py b/models/scop_liasse_fiscale.py index 70afb7c0141e26ac5f3057153e12648069abf484..f98cbe936a5fdeaad19438e3ba3947db33b4d1fd 100644 --- a/models/scop_liasse_fiscale.py +++ b/models/scop_liasse_fiscale.py @@ -50,7 +50,7 @@ class ScopLiasseFiscale(models.Model): # ------------------------------------------------------ # Compute fields # ------------------------------------------------------ - @api.depends("av_lf", "av_cg", "revenue_cg", "dureeExercice") + @api.depends("av_lf", "av_cg", "L2052_FL", "dureeExercice") def _compute_contribution_cg(self): """ Calcule la cotisation de la CG Scop : @@ -64,9 +64,9 @@ class ScopLiasseFiscale(models.Model): """ for liasse in self: # Calcul VA - liasse.read(["av_lf", "av_cg", "revenue_cg"]) + liasse.read(["av_lf", "av_cg", "L2052_FL"]) va = liasse.av_lf if liasse.av_lf > 0 else liasse.av_cg - ca = liasse.revenue_cg + ca = liasse.L2052_FL if liasse.dureeExercice and liasse.dureeExercice not in (0, 12): va = va * (12 / liasse.dureeExercice) ca = ca * (12 / liasse.dureeExercice) @@ -340,10 +340,10 @@ class ScopLiasseFiscale(models.Model): self.env.ref("cgscop_partner.form_coop47"), self.env.ref("cgscop_partner.form_lamaneur"), ): - plancher1 = 1 / 3 * plancher1 - plancher2 = 1 / 3 * plancher2 - plancher3 = 1 / 3 * plancher3 - plafond = 1 / 3 * plafond + plancher1 = 2 / 3 * plancher1 + plancher2 = 2 / 3 * plancher2 + plancher3 = 2 / 3 * plancher3 + plafond = 2 / 3 * plafond return { "plancher1": plancher1, diff --git a/views/scop_cotisation_cg.xml b/views/scop_cotisation_cg.xml index 552baeb226414b96594bce3120ecc6ea827e7b6e..05543173cc567d540b8c90bf9fd91a36c7059cf0 100644 --- a/views/scop_cotisation_cg.xml +++ b/views/scop_cotisation_cg.xml @@ -112,7 +112,6 @@ style="margin-right: 20px; width: 250px;" type="object" string="Globale : CG, UR et Fédération" - attrs="{'invisible': [('state', '!=', 'new')]}" context="{'type_simul': 'all'}" /> @@ -122,7 +121,6 @@ style="width: 250px;" type="object" string="CG Scop uniquement" - attrs="{'invisible': [('state', '!=', 'new')]}" context="{'type_simul': 'cgscop'}" /> <field name="simul_ids" mode="tree" />