diff --git a/models/account_invoice.py b/models/account_invoice.py index e1311a41d66d1ff5b18d32fd558d5f61e7307909..ba7f3aebc1ec29a5b474512c1e11fb810bd10c48 100644 --- a/models/account_invoice.py +++ b/models/account_invoice.py @@ -35,6 +35,44 @@ class ScopAccountInvoiceCG(models.Model): round_to_closest_multiple( i.amount_cg_calculated * prorata, i.nb_quarter) + # ------------------------------------------------------ + # Override parent + # ------------------------------------------------------ + @api.multi + def set_scop_contribution(self): + contrib_id = super(ScopAccountInvoiceCG, self).set_scop_contribution() + if self.cotisation_cg_id: + i = 4 - self.nb_quarter + schedule = { + 'quarter_1': self.cotisation_cg_id.trimester_1, + 'quarter_2': self.cotisation_cg_id.trimester_2, + 'quarter_3': self.cotisation_cg_id.trimester_3, + 'quarter_4': self.cotisation_cg_id.trimester_4, + } + while i != 0: + key = 'quarter_' + str(i) + schedule.pop(key, None) + i -= 1 + contrib_id.update(schedule) + return contrib_id + + def set_scop_contribution_hook(self, contrib_id): + """ + Compute contribution line amount if bordereau regul + :param contrib_id: + :return: + """ + super(ScopAccountInvoiceCG, self).set_scop_contribution_hook(contrib_id) + if self.bordereau_id: + invoice_ids = self.bordereau_id.invoice_ids.filtered( + lambda i: i.type_contribution_id == contrib_id.type_id + ) + contrib_id.update({ + 'amount_calculated': sum(invoice_ids.mapped('amount_total_signed')), + 'amount_called': sum(invoice_ids.mapped('amount_total_signed')), + }) + return contrib_id + # ------------------------------------------------------ # Global functions # ------------------------------------------------------ diff --git a/report/report_scop_bordereau.xml b/report/report_scop_bordereau.xml index 9dab8391be5831fc87cb631841f30f880be65a20..d1eef71f299f85bb2ce267a96c253cbcbd99f5cc 100644 --- a/report/report_scop_bordereau.xml +++ b/report/report_scop_bordereau.xml @@ -21,7 +21,7 @@ <p> N° adhérent : <t t-esc="str(o.partner_id.member_number_int)"/><br/> Union régionale : <span t-field="o.partner_ur_id.name"/><br/> - N° Bordereau : <span t-field="o.name"/> + N° Bordereau : <span t-field="o.name"/><t t-if="o.is_regul">-<span t-field="o.version"/></t> </p> </div> </div> @@ -35,6 +35,14 @@ <t t-if="o.partner_id.cedex"> <span t-field="o.partner_id.cedex"/></t> </div> </div> + <t t-if="o.is_regul"> + <div class="row"> + <div class="col-12" style="test-align: justify;"> + Une régularisation du bordereau initial a été effectuée pour le motif suivant : <span t-field="o.comment_regul"/><br/> + Date de régularisation : <span t-field="o.date_regul"/> + </div> + </div> + </t> <div class="row mb16"> <div class="col-12" style="font-style: italic; test-align: justify;"> Les cotisations sont calculées annuellement en début d’année sur la base du dernier exercice connu. Le versement se fait par quart tous les trimestres. Merci de retourner ce bordereau à la CG Scop avec le règlement correspondant @@ -52,8 +60,8 @@ <t t-set="amount_line" t-value="o.get_contribution_type()" /> <table class="table table-sm" style="border: none;"> <tr t-foreach="amount_line" t-as="line" style="border-bottom: 1px solid #ccc;"> - <td style="border: none; background: inherit; color: inherit;"><t t-esc="line.get('type_contribution')"/></td> - <td class="text-right" style="border: none; background: inherit; color: inherit;"><t t-esc="line.get('amount')" t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"/></td> + <td style="border: none; background: inherit; color: inherit;"><t t-esc="line.get('type_contribution_id')[1]"/></td> + <td class="text-right" style="border: none; background: inherit; color: inherit;"><t t-esc="line.get('amount_total_signed')" t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"/></td> </tr> </table> </p> diff --git a/views/scop_bordereau_cg.xml b/views/scop_bordereau_cg.xml index e8c47ca04c1f83ea8af71c218730aabbab124d70..b8174fb0cbc8f78a5f45fe54628ad95592ed8476 100644 --- a/views/scop_bordereau_cg.xml +++ b/views/scop_bordereau_cg.xml @@ -16,17 +16,31 @@ <button name="print_bordereau" string="Imprimer" type="object" states="validated,paid"/> <button name="action_send_email" string="Envoyer par mail" type="object" states="validated"/> <button name="update_cotiz_and_lines" class="btn-info" string="Mettre à jour les cotisations" type="object" states="new"/> + <button name="%(cgscop_cotisation_cg.scop_cotisation_regul_wizard_act_window)d" + class="btn-warning" + string="Effectuer une Régularisation" + type="action" + states="validated,paid"/> </header> <sheet> <div class="oe_title"> <h1> - <field name="name" placeholder="Title"/> + <field name="name"/> + <span class="o_field_char o_field_widget" attrs="{'invisible': [('version', '=', 1)]}">-</span> + <field name="version" attrs="{'invisible': [('version', '=', 1)]}"/> </h1> </div> <h4> Adhérent : <field name="partner_id"/> <br/> UR : <field name="partner_ur_id" readonly="True" options="{'no_open': True}"/> </h4> + <field name="is_regul" invisible="1"/> + <div class="alert alert-warning" role="alert" attrs="{'invisible': [('is_regul', '!=', True)]}"> + <group> + <field name="date_regul"/> + <field name="comment_regul"/> + </group> + </div> <group> <group> <field name="base_cotisation_cg"/> @@ -47,18 +61,21 @@ <field name="invoice_ids" widget="one2many"> <tree edit="false" create="false" delete="false"> <field name="type_contribution_id"/> - <field name="date_due"/> + <field name="date_invoice"/> + <field name="name"/> <field name="amount_total_signed" string="Montant total" sum="Total"/> - <field name="residual" string="Montant dû" sum="Total"/> + <field name="residual_signed" string="Montant dû" sum="Total"/> <field name="state"/> <button name="view_cotiz" string="Afficher" type="object" icon="fa-pencil-square-o"/> </tree> <form> <group> <field name="type_contribution_id"/> - <field name="date_due"/> + <field name="date_invoice"/> + <field name="name"/> <field name="amount_cg_calculated"/> <field name="amount_total_signed"/> + <field name="residual_signed"/> <field name="nb_quarter" /> <field name="state"/> </group> @@ -124,7 +141,9 @@ <field name="model">scop.bordereau</field> <field name="arch" type="xml"> <tree decoration-info="state == 'new'" create="false" string="Bordereaux"> + <field name="member_number"/> <field name="partner_id"/> + <field name="partner_ur_id"/> <field name="year"/> <field name="state"/> <field name="type_assiette_retenu"/>