From ae1b366692cd69516afbd81ec9300367f3c8e509 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Wed, 11 Sep 2019 13:08:52 +0200 Subject: [PATCH] [12.0][FIX] - create contract only on sale and done states --- product_contract/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product_contract/models/sale_order.py b/product_contract/models/sale_order.py index 6eb6a973..0d528a51 100644 --- a/product_contract/models/sale_order.py +++ b/product_contract/models/sale_order.py @@ -19,7 +19,7 @@ class SaleOrder(models.Model): @api.depends('order_line.contract_id', 'state') def _compute_need_contract_creation(self): for rec in self: - if rec.state not in ('draft', 'sent'): + if rec.state in ('sale', 'done'): line_to_create_contract = rec.order_line.filtered( lambda r: not r.contract_id and r.product_id.is_contract )