[IMP] - use terminate term instead of resiliate

This commit is contained in:
sbejaoui
2020-03-10 11:30:06 +01:00
committed by Adasat
parent a31dd36d59
commit 9dd48e8d5d
4 changed files with 12 additions and 12 deletions

View File

@@ -18,15 +18,15 @@ class SaleOrder(models.Model):
)
@api.constrains('state')
def check_contact_is_not_resiliated(self):
def check_contact_is_not_terminated(self):
for rec in self:
if rec.state not in (
'sale',
'done',
'cancel',
) and rec.order_line.filtered('contract_id.is_resiliated'):
) and rec.order_line.filtered('contract_id.is_terminated'):
raise ValidationError(
_("You can't upsell or downsell a resiliated contract")
_("You can't upsell or downsell a terminated contract")
)
@api.depends('order_line.contract_id', 'state')

View File

@@ -68,14 +68,14 @@ class SaleOrderLine(models.Model):
)
@api.constrains('contract_id')
def check_contact_is_not_resiliated(self):
def check_contact_is_not_terminated(self):
for rec in self:
if (
rec.order_id.state not in ('sale', 'done', 'cancel')
and rec.contract_id.is_resiliated
and rec.contract_id.is_terminated
):
raise ValidationError(
_("You can't upsell or downsell a resiliated contract")
_("You can't upsell or downsell a terminated contract")
)
@api.multi