diff --git a/models/account_move.py b/models/account_move.py index 72c850ab069c343afa5a6e4bbe6533ba5ecbd986..88d554c99b966627bfa022da12030db875f8e878 100644 --- a/models/account_move.py +++ b/models/account_move.py @@ -30,6 +30,14 @@ class ScopAccountMove(models.Model): currency_field="company_currency_id", compute="_compute_amount_called", ) + refund_contribution_type = fields.Selection( + [ + ("correction", "Correction"), + ("exemption", "Exonération"), + ("cancel", "Annulation"), + ], + string="Type d'avoir de cotisation", + ) # ------------------------------------------------------ # Compute fields diff --git a/models/scop_bordereau_cg.py b/models/scop_bordereau_cg.py index 6e23718ccdc97534deb4a86071d8da65172f077f..096246755577a8f9d4326c09e764b5de994a718a 100644 --- a/models/scop_bordereau_cg.py +++ b/models/scop_bordereau_cg.py @@ -835,16 +835,14 @@ class Bordereau(models.Model): "cgscop_partner.cotiz_fede_indus" ).id # Calcul de la cotisation de la fédé de l'industrie - if partner.staff_last == 0: - # Forfait de 4 € si pas de salariés + if liasse: + amount_fede_indus = base_cotiz.round_to_closest_multiple( + liasse.contribution_indus, 4 + ) + elif partner.staff_last == 0: amount_fede_indus = 4 else: - if liasse: - amount_fede_indus = base_cotiz.round_to_closest_multiple( - liasse.contribution_indus, 4 - ) - else: - amount_fede_indus = 120 + amount_fede_indus = 120 # Création des factures associées self.create_contribution( diff --git a/models/scop_liasse_fiscale.py b/models/scop_liasse_fiscale.py index ccc978037e1c80975d8f876a63eaee589e4ec37f..b9c821cce3c1bf0022764f395572caed298c9767 100644 --- a/models/scop_liasse_fiscale.py +++ b/models/scop_liasse_fiscale.py @@ -311,14 +311,18 @@ class ScopLiasseFiscale(models.Model): """ for liasse in self: if liasse.is_federation_indus: - va = liasse.get_va() - contrib = round(va * 0.0003, 2) - if contrib < 120: - liasse.contribution_indus = 120 - elif contrib >= 1000: - liasse.contribution_indus = 1000 + if liasse.partner_id.staff_last == 0: + # Forfait de 4 € si pas de salariés + liasse.contribution_indus = 4 else: - liasse.contribution_indus = contrib + va = liasse.get_va() + contrib = round(va * 0.0003, 2) + if contrib < 120: + liasse.contribution_indus = 120 + elif contrib >= 1000: + liasse.contribution_indus = 1000 + else: + liasse.contribution_indus = contrib @api.depends("contribution_cg") def _compute_contribution_idf(self): @@ -341,6 +345,19 @@ class ScopLiasseFiscale(models.Model): else: liasse.contribution_idf = contribution_idf + # ------------------------------------------------------ + # Action button + # ------------------------------------------------------ + def action_recompute_contribution(self): + for liasse in self: + liasse._compute_contribution_cg() + liasse._compute_contribution_hdf() + liasse._compute_contribution_med() + liasse._compute_contribution_com() + liasse._compute_contribution_cae() + liasse._compute_contribution_indus() + liasse._compute_contribution_idf() + # ------------------------------------------------------ # Business Function # ------------------------------------------------------ diff --git a/views/account_move.xml b/views/account_move.xml index a74724982b2f1cd5e03215b3be340748a0fb0761..a92faa17975434c796c20d47b1c9040e787a0981 100644 --- a/views/account_move.xml +++ b/views/account_move.xml @@ -42,6 +42,10 @@ <group> <field name="liasse_fiscale_id" readonly="1" /> <field name="bordereau_id" readonly="1" /> + <field + name="refund_contribution_type" + attrs="{'invisible': [('move_type', '!=', 'out_refund')]}" + /> </group> <group> <field name="amount_cg_calculated" readonly="1" /> diff --git a/views/scop_liasse_fiscale.xml b/views/scop_liasse_fiscale.xml index 46959c221eff02b8393c786bcd1be877c6231543..80000bd35e26aaabca13a30e09ca68afe511a086 100644 --- a/views/scop_liasse_fiscale.xml +++ b/views/scop_liasse_fiscale.xml @@ -19,7 +19,15 @@ <strong><u>Cotisations théoriques</u></strong><br /> Cette section donne les montants théoriques des diverses cotisations en fonction des valeurs de la liasse fiscale. </div> + <button + name="action_recompute_contribution" + type="object" + string="Recalculer les cotisations" + class="btn-outline-primary" + groups="cgscop_partner.group_cg_administrative" + /> <group name="simulation"> + <group> <field name="contribution_base_type" diff --git a/wizard/scop_bordereau_refund_wizard.py b/wizard/scop_bordereau_refund_wizard.py index 93c7f3fd7efab5ec1853b0e42cc991050abded0e..fbd29acac107da863478499c02807a93270b735b 100644 --- a/wizard/scop_bordereau_refund_wizard.py +++ b/wizard/scop_bordereau_refund_wizard.py @@ -32,6 +32,14 @@ class ScopBordereauRefundWizard(models.TransientModel): comodel_name="scop.bordereau.refund.wizard.quarter", string="Trimestres", ) + refund_contribution_type = fields.Selection( + [ + ("correction", "Correction"), + ("exemption", "Exonération"), + ("cancel", "Annulation"), + ], + string="Type d'avoir de cotisation", + ) # ------------------------------------------------------ # Constrains diff --git a/wizard/scop_bordereau_refund_wizard.xml b/wizard/scop_bordereau_refund_wizard.xml index e20305b8b440864e2cd43e8cbad4677f36274816..70c4ae9ee1917307a5cd90138c7279703b73d394 100644 --- a/wizard/scop_bordereau_refund_wizard.xml +++ b/wizard/scop_bordereau_refund_wizard.xml @@ -14,6 +14,7 @@ <field name="cotiz_reminder" /> <hr /> <field name="type_cotiz" /> + <field name="refund_contribution_type" required="True" /> <field name="date_refund" /> <separator /> <field name="amount_refund" /> diff --git a/wizard/scop_cotisation_cg_regul.py b/wizard/scop_cotisation_cg_regul.py index 3b008201c0ae2879daf6f207dcf0252a1df9b506..f5df5b4ae5da294df4dc4026b12e5a62b1fe4889 100644 --- a/wizard/scop_cotisation_cg_regul.py +++ b/wizard/scop_cotisation_cg_regul.py @@ -70,6 +70,16 @@ class ScopCotisationRegul(models.TransientModel): amount_fede_indus = fields.Float(related="liasse_fiscale_new_id.contribution_indus") is_payment = fields.Boolean("Paiements liés") + refund_contribution_type = fields.Selection( + [ + ("correction", "Correction"), + ("exemption", "Exonération"), + ("cancel", "Annulation"), + ], + string="Type d'avoir de cotisation", + default="correction", + required=True + ) # ------------------------------------------------------ # Constrains diff --git a/wizard/scop_cotisation_cg_regul_wizard.xml b/wizard/scop_cotisation_cg_regul_wizard.xml index 66ad93cfdf085b86dc0244b3027728e8189ffe06..2bfb1de557f90c97217fdcc8bf165eaae8d15c12 100644 --- a/wizard/scop_cotisation_cg_regul_wizard.xml +++ b/wizard/scop_cotisation_cg_regul_wizard.xml @@ -58,6 +58,7 @@ <div class="col-6"> <group string="Nouveaux calculs"> <field name="date_regul" required="1" /> + <field name="refund_contribution_type" required="1" /> <separator /> <field name="liasse_fiscale_new_id"