From 3a3d7cd87180ca5490c6974dee11673a03eb1f32 Mon Sep 17 00:00:00 2001 From: benjamin <benjamin@le-filament.com> Date: Thu, 30 Sep 2021 17:52:33 +0200 Subject: [PATCH] [undo] add invoiced_member_count --- models/scop_cotisation.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/models/scop_cotisation.py b/models/scop_cotisation.py index bb50c15..f52a3f9 100644 --- a/models/scop_cotisation.py +++ b/models/scop_cotisation.py @@ -51,6 +51,9 @@ class ScopCotisation(models.AbstractModel): new_member_count = fields.Integer( "Nouveaux adhérents", compute='_compute_new_member_count') + invoiced_member_count = fields.Integer( + "Cotisations créées", + compute='_compute_invoiced_member_count') trimester_1 = fields.Date('1er Trimestre') trimester_2 = fields.Date('2ème Trimestre') trimester_3 = fields.Date('3ème Trimestre') @@ -69,6 +72,12 @@ class ScopCotisation(models.AbstractModel): for cotiz in self: cotiz.new_member_count = len(cotiz.get_new_members()) + @api.multi + def _compute_invoiced_member_count(self): + for cotiz in self: + cotiz.invoiced_member_count = len( + cotiz.invoice_ids.mapped('partner_id')) + # ------------------------------------------------------ # Global functions # ------------------------------------------------------ -- GitLab