From 66f87ed5f1556d175195d5e511b4c49c284cf7c1 Mon Sep 17 00:00:00 2001 From: benjamin <benjamin@le-filament.com> Date: Thu, 15 Dec 2022 17:08:30 +0100 Subject: [PATCH] [update] get_liasse function to add year > 0 in search domain --- models/scop_cotisation_cg.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/models/scop_cotisation_cg.py b/models/scop_cotisation_cg.py index 754fb86..ed01358 100644 --- a/models/scop_cotisation_cg.py +++ b/models/scop_cotisation_cg.py @@ -761,6 +761,7 @@ class ScopCotisation(models.Model): [ ("partner_id", "=", member.id), ("is_qualified", "=", True), + ("year", ">", 0), "|", "|", ("L2052_FL", ">", 0), @@ -769,6 +770,21 @@ class ScopCotisation(models.Model): ], order="year desc", ) + + if not liasse_ids: + liasse_ids = Liasse.search( + [ + ("partner_id", "=", member.id), + ("is_qualified", "=", True), + "|", + "|", + ("L2052_FL", ">", 0), + ("av_lf", ">", 0), + ("av_cg", ">", 0), + ], + order="id desc", + ) + if liasse_ids: last_liasse = liasse_ids[0] if last_liasse.year > 0: -- GitLab