diff --git a/models/account_move.py b/models/account_move.py index a7bc458d42caf0a866bb4e08eb66c52551c624fe..72c850ab069c343afa5a6e4bbe6533ba5ecbd986 100644 --- a/models/account_move.py +++ b/models/account_move.py @@ -39,8 +39,11 @@ class ScopAccountMove(models.Model): if invoice.move_type == "out_invoice": payment_ids = invoice.move_line_payment_ids refund_ids = payment_ids.mapped("move_id").filtered( - lambda r: r.move_type == "out_refund") - invoice.amount_called = invoice.amount_total_signed + sum(refund_ids.mapped("amount_total_signed")) + lambda r: r.move_type == "out_refund" + ) + invoice.amount_called = invoice.amount_total_signed + sum( + refund_ids.mapped("amount_total_signed") + ) else: invoice.amount_called = 0 diff --git a/models/scop_bordereau_cg.py b/models/scop_bordereau_cg.py index eb9af3d9c8168bc6d11a04458f62d9b668fa6ab9..73e8a112ce86ad67d3f7fbec026a87cce137509c 100644 --- a/models/scop_bordereau_cg.py +++ b/models/scop_bordereau_cg.py @@ -989,7 +989,9 @@ class Bordereau(models.Model): # Variables cotisations UR if partner_id.ur_id.id == ur_hdf: - amount_ur = liasse_fiscale_new_id.contribution_hdf if liasse_fiscale_new_id else 40 + amount_ur = ( + liasse_fiscale_new_id.contribution_hdf if liasse_fiscale_new_id else 40 + ) product_ur = self.env.company.contribution_hdf_id journal_ur = self.env.user.company_id.journal_ur_hdf_id else: # ur = ur_med @@ -1006,13 +1008,17 @@ class Bordereau(models.Model): partner_id.property_account_receivable_id.id, ], self.env.ref("cgscop_partner.riga_14398").id: [ - liasse_fiscale_new_id.contribution_com if liasse_fiscale_new_id else 108, + liasse_fiscale_new_id.contribution_com + if liasse_fiscale_new_id + else 108, self.env.company.contribution_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: [ - liasse_fiscale_new_id.contribution_cae if liasse_fiscale_new_id else 300, + liasse_fiscale_new_id.contribution_cae + if liasse_fiscale_new_id + else 300, self.env.company.contribution_fede_cae_id, self.env.user.company_id.journal_fede_cae_id, partner_id.property_account_receivable_id.id, @@ -1206,12 +1212,17 @@ class Bordereau(models.Model): Move = self.env["account.move"] for bordereau in self: payments = bordereau.invoice_ids.move_line_payment_ids.filtered( - lambda r: r.move_id.move_type == "entry").sorted(lambda p: p.date) + lambda r: r.move_id.move_type == "entry" + ).sorted(lambda p: p.date) schedule_plan = Move.read_group( [ ("bordereau_id", "=", bordereau.id), ], - fields=["cotiz_quarter", "amount_total_signed", "amount_residual_signed"], + fields=[ + "cotiz_quarter", + "amount_total_signed", + "amount_residual_signed", + ], groupby=["cotiz_quarter"], orderby="cotiz_quarter", lazy=False, @@ -1226,8 +1237,9 @@ class Bordereau(models.Model): i = int(contribution.get("cotiz_quarter")) - 1 contribution["date_maturity"] = schedule_date[i] - total_amount = sum(list(map( - lambda l: l.get("amount_total_signed"), schedule_plan))) + total_amount = sum( + list(map(lambda l: l.get("amount_total_signed"), schedule_plan)) + ) total_residual = sum( list(map(lambda l: l.get("amount_residual_signed"), schedule_plan)) ) diff --git a/templates/report_scop_bordereau_payments.xml b/templates/report_scop_bordereau_payments.xml index b2cd1487ce3d4ea9711c025713cab705e21d187d..8d8b91fdbbe9412b28c33fb8c5f498429c2f0966 100644 --- a/templates/report_scop_bordereau_payments.xml +++ b/templates/report_scop_bordereau_payments.xml @@ -56,7 +56,10 @@ N° Bordereau : <span t-field="o.name" /><t t-if="o.is_regul" >-<span t-field="o.version" /></t><br /> - Le <t t-esc="datetime.date.today()" t-options="{'widget': 'date', 'format': 'dd MMMM YYYY'}" /> + Le <t + t-esc="datetime.date.today()" + t-options="{'widget': 'date', 'format': 'dd MMMM YYYY'}" + /> </p> </div> </div> @@ -188,7 +191,10 @@ <div class="row oe_mt32"> <!-- Rappel Echéancier --> <div class="col-6" style="border: 1px solid #aaa;"> - <h5 class="oe_mt8" style="font-weight: 600;">Rappel Échéancier</h5> + <h5 + class="oe_mt8" + style="font-weight: 600;" + >Rappel Échéancier</h5> <p id="schedule_table_with_payments"> <table class="table table-sm table-striped" @@ -207,7 +213,8 @@ <td style="border: none; background: inherit; color: inherit;" ><t - t-esc="line.get('date_maturity')" t-options="{'widget': 'date', 'format': 'dd/MM/YYYY'}" + t-esc="line.get('date_maturity')" + t-options="{'widget': 'date', 'format': 'dd/MM/YYYY'}" /></td> <td class="text-right" @@ -234,7 +241,10 @@ <!-- Détail des règlements --> <div class="col-6" style="border: 1px solid #aaa;"> - <h5 class="oe_mt8" style="font-weight: 600;">Détail des règlements</h5> + <h5 + class="oe_mt8" + style="font-weight: 600;" + >Détail des règlements</h5> <p id="schedule_table_with_payments"> <table class="table table-sm table-striped" @@ -252,7 +262,8 @@ <td style="border: none; background: inherit; color: inherit;" ><t - t-esc="payment.date" t-options="{'widget': 'date', 'format': 'dd/MM/YYYY'}" + t-esc="payment.date" + t-options="{'widget': 'date', 'format': 'dd/MM/YYYY'}" /></td> <td class="text-right"