From f338eed0234a2ad5946bfa4ade80841a52cca1b6 Mon Sep 17 00:00:00 2001
From: benjamin <benjamin@le-filament.com>
Date: Mon, 5 Jun 2023 09:49:02 +0200
Subject: [PATCH] [update] compute state base contribution
---
models/scop_cotisation_cg.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/models/scop_cotisation_cg.py b/models/scop_cotisation_cg.py
index e1c16c0..d485fd0 100644
--- a/models/scop_cotisation_cg.py
+++ b/models/scop_cotisation_cg.py
@@ -183,14 +183,18 @@ class ScopCotisation(models.Model):
]
)
- @api.depends("invoice_ids", "invoice_ids.state")
+ @api.depends("invoice_ids", "invoice_ids.state", "invoice_ids.payment_state")
def _compute_state(self):
for cotiz in self:
if len(cotiz.invoice_ids) == 0:
cotiz.state = "new"
elif (
len(cotiz.invoice_ids)
- == len(cotiz.invoice_ids.filtered(lambda i: i.state == "posted"))
+ == len(
+ cotiz.invoice_ids.filtered(
+ lambda i: i.state == "posted" and i.payment_state == "paid"
+ )
+ )
and cotiz.state != "end"
):
cotiz.state = "end"
--
GitLab