[IMP] sale: Convert _onchange_product_id_set_customer_lead into compute method
This commit is contained in:
@@ -747,9 +747,6 @@ class SaleOrderLine(models.Model):
|
||||
'tax_id', 'analytic_tag_ids'
|
||||
]
|
||||
|
||||
def _onchange_product_id_set_customer_lead(self):
|
||||
pass
|
||||
|
||||
@api.onchange('product_id', 'price_unit', 'product_uom', 'product_uom_qty', 'tax_id')
|
||||
def _onchange_discount(self):
|
||||
if not (self.product_id and self.product_uom and
|
||||
|
||||
@@ -125,7 +125,6 @@ class SaleOrder(models.Model):
|
||||
for line in self.order_line.filtered(lambda line: line.product_id.id in product_ids):
|
||||
res = line.product_id_change() or res
|
||||
line._onchange_discount()
|
||||
line._onchange_product_id_set_customer_lead()
|
||||
return res
|
||||
|
||||
def _get_matrix(self, product_template):
|
||||
|
||||
@@ -280,6 +280,8 @@ class SaleOrderLine(models.Model):
|
||||
qty_to_deliver = fields.Float(compute='_compute_qty_to_deliver', digits='Product Unit of Measure')
|
||||
is_mto = fields.Boolean(compute='_compute_is_mto')
|
||||
display_qty_widget = fields.Boolean(compute='_compute_qty_to_deliver')
|
||||
customer_lead = fields.Float(
|
||||
compute='_compute_customer_lead', store=True, readonly=False, pre_compute=True)
|
||||
|
||||
@api.depends('product_type', 'product_uom_qty', 'qty_delivered', 'state', 'move_ids', 'product_uom')
|
||||
def _compute_qty_to_deliver(self):
|
||||
@@ -470,9 +472,10 @@ class SaleOrderLine(models.Model):
|
||||
else:
|
||||
line.product_updatable = False
|
||||
|
||||
@api.onchange('product_id')
|
||||
def _onchange_product_id_set_customer_lead(self):
|
||||
self.customer_lead = self.product_id.sale_delay
|
||||
@api.depends('product_id')
|
||||
def _compute_customer_lead(self):
|
||||
for order in self:
|
||||
order.customer_lead = order.product_id.sale_delay
|
||||
|
||||
def _prepare_procurement_values(self, group_id=False):
|
||||
""" Prepare specific key for moves or other components that will be created from a stock rule
|
||||
|
||||
Reference in New Issue
Block a user