From afe8459d9ec4b07e21d254676aca19e42cd4dfe5 Mon Sep 17 00:00:00 2001 From: jordan <jordan@le-filament.com> Date: Wed, 23 Feb 2022 10:30:57 +0100 Subject: [PATCH] [fix] test if regul is based on type contribution --- models/scop_bordereau_cg.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/models/scop_bordereau_cg.py b/models/scop_bordereau_cg.py index a5e98b6..e19df46 100644 --- a/models/scop_bordereau_cg.py +++ b/models/scop_bordereau_cg.py @@ -346,6 +346,7 @@ class Bordereau(models.Model): ' €</td></tr>') detail += "</table><table class='o_group o_inner_group'>" for i in range(1, 5): + # Add amount echeance amount_echeance = round(sum(r.invoice_ids.filtered( lambda inv: inv.cotiz_quarter == i ).mapped('amount_total_signed')), 2) @@ -353,11 +354,17 @@ class Bordereau(models.Model): + 'Trimestre ' + str(i) \ + '</td><td style="width: 100%;">' \ + str(amount_echeance) + ' €' - is_exo = len(r.invoice_ids.filtered( - lambda inv: inv.cotiz_quarter == i - )) > 1 - if is_exo: - detail += ' ' + '<i class="fa fa-star-o" />' + # Check if regul has been done after validation + type_contribs = r.invoice_ids.mapped('type_contribution_id') + for type_contrib in type_contribs: + is_exo = len(r.invoice_ids.filtered( + lambda inv: + inv.cotiz_quarter == i and + inv.type_contribution_id == type_contrib + )) > 1 + if is_exo: + detail += ' ' + '<i class="fa fa-star-o" />' + break detail += '</td></tr>' detail += '</table>' r.details = detail -- GitLab