From cf7775343dae751fdeb3a44b7856bce020e70254 Mon Sep 17 00:00:00 2001 From: manu Date: Fri, 29 Oct 2021 16:56:06 +0200 Subject: [PATCH] [FIX]contract: Avoid error in invoicing contracts crone --- contract/models/contract.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contract/models/contract.py b/contract/models/contract.py index b1c159b32..63c13329b 100644 --- a/contract/models/contract.py +++ b/contract/models/contract.py @@ -646,6 +646,8 @@ class ContractContract(models.Model): for row in companies_to_invoice: contracts_to_invoice = self.search(row["__domain"]).with_context( allowed_company_ids=[row["company_id"][0]] + ).filtered( + lambda a: not a.date_end or a.recurring_next_date <= a.date_end ) invoices |= contracts_to_invoice._recurring_create_invoice(date_ref) return invoices