mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[12.0][FIX] - create contract only on sale and done states
This commit is contained in:
@@ -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
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user