[IMP] sale: clean product sale warning onchange part
Simplify the code, and do not instantiate useless variables when not needed.
This commit is contained in:
@@ -625,20 +625,16 @@ class SaleOrderLine(models.Model):
|
||||
vals['price_unit'] = self.env['account.tax']._fix_tax_included_price_company(self._get_display_price(product), product.taxes_id, self.tax_id, self.company_id)
|
||||
self.update(vals)
|
||||
|
||||
title = False
|
||||
message = False
|
||||
result = {}
|
||||
warning = {}
|
||||
if product.sale_line_warn != 'no-message':
|
||||
title = _("Warning for %s", product.name)
|
||||
message = product.sale_line_warn_msg
|
||||
warning['title'] = title
|
||||
warning['message'] = message
|
||||
result = {'warning': warning}
|
||||
if product.sale_line_warn == 'block':
|
||||
self.product_id = False
|
||||
|
||||
return result
|
||||
return {
|
||||
'warning': {
|
||||
'title': _("Warning for %s", product.name),
|
||||
'message': product.sale_line_warn_msg,
|
||||
}
|
||||
}
|
||||
|
||||
@api.onchange('product_uom', 'product_uom_qty')
|
||||
def product_uom_change(self):
|
||||
|
||||
Reference in New Issue
Block a user