[FIX] mrp: do not erase move raw at onchange without bom
With this commit, the move raw refresher onchange is bypassed in case of empty BoM. As the manufacturing user can adds some components on the fly to create a non manufactured product, changing the quantity to produce or the unit of measur will erase all the move raw and recreate them from the BoM lines. As no boms are set, the components are just deleted. Task : 2278147
This commit is contained in:
@@ -604,6 +604,8 @@ class MrpProduction(models.Model):
|
||||
|
||||
@api.onchange('bom_id', 'product_id', 'product_qty', 'product_uom_id')
|
||||
def _onchange_move_raw(self):
|
||||
if not self.bom_id and not self._origin.product_id:
|
||||
return
|
||||
# Clear move raws if we are changing the product. In case of creation (self._origin is empty),
|
||||
# we need to avoid keeping incorrect lines, so clearing is necessary too.
|
||||
if self.product_id != self._origin.product_id:
|
||||
|
||||
Reference in New Issue
Block a user