Browse Source

[12.0][FIX] - create contract only on sale and done states

pull/208/head
sbejaoui 5 years ago
committed by Thomas Binsfeld
parent
commit
ae1b366692
  1. 2
      product_contract/models/sale_order.py

2
product_contract/models/sale_order.py

@ -19,7 +19,7 @@ class SaleOrder(models.Model):
@api.depends('order_line.contract_id', 'state') @api.depends('order_line.contract_id', 'state')
def _compute_need_contract_creation(self): def _compute_need_contract_creation(self):
for rec in 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( line_to_create_contract = rec.order_line.filtered(
lambda r: not r.contract_id and r.product_id.is_contract lambda r: not r.contract_id and r.product_id.is_contract
) )

Loading…
Cancel
Save