From 921bcaf1f23a4bab461ac81d088c80cb63d41322 Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Tue, 28 Jun 2022 19:23:41 +0200 Subject: [PATCH] [14.0][FIX] contract: Get correct domain for In Progress contract lines As termination_notice_date field is void on not finished contract lines, domain to search for In Progress ones should take into account void values --- contract/models/contract_line.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/contract/models/contract_line.py b/contract/models/contract_line.py index c38f75ed3..b438e0677 100644 --- a/contract/models/contract_line.py +++ b/contract/models/contract_line.py @@ -199,12 +199,16 @@ class ContractLine(models.Model): today = fields.Date.context_today(self) if state == "upcoming": return [ + "&", + ("display_type", "=", False), "&", ("date_start", ">", today), ("is_canceled", "=", False), ] if state == "in-progress": return [ + "&", + ("display_type", "=", False), "&", "&", "&", @@ -217,10 +221,14 @@ class ContractLine(models.Model): ("is_auto_renew", "=", True), "&", ("is_auto_renew", "=", False), + "|", + ("termination_notice_date", "=", False), ("termination_notice_date", ">", today), ] if state == "to-renew": return [ + "&", + ("display_type", "=", False), "&", "&", ("is_canceled", "=", False), @@ -233,6 +241,8 @@ class ContractLine(models.Model): ] if state == "upcoming-close": return [ + "&", + ("display_type", "=", False), "&", "&", "&", @@ -247,6 +257,8 @@ class ContractLine(models.Model): ] if state == "closed": return [ + "&", + ("display_type", "=", False), "&", "&", "&", @@ -260,7 +272,7 @@ class ContractLine(models.Model): ("manual_renew_needed", "=", False), ] if state == "canceled": - return [("is_canceled", "=", True)] + return ["&", ("display_type", "=", False), ("is_canceled", "=", True)] if not state: return [("display_type", "!=", False)]