[IMP] stock,mrp: origin of scrap move
If the user has not filled in the origin in the scrap object, we set it to be its associated picking or production order if any.
This commit is contained in:
@@ -41,6 +41,7 @@ class StockScrap(models.Model):
|
||||
def _prepare_move_values(self):
|
||||
vals = super(StockScrap, self)._prepare_move_values()
|
||||
if self.production_id:
|
||||
vals['origin'] = vals['origin'] or self.production_id.name
|
||||
if self.product_id in self.production_id.move_finished_ids.mapped('product_id'):
|
||||
vals.update({'production_id': self.production_id.id})
|
||||
else:
|
||||
|
||||
@@ -93,7 +93,7 @@ class StockScrap(models.Model):
|
||||
self.ensure_one()
|
||||
return {
|
||||
'name': self.name,
|
||||
'origin': self.origin,
|
||||
'origin': self.origin or self.picking_id.name,
|
||||
'product_id': self.product_id.id,
|
||||
'product_uom': self.product_uom_id.id,
|
||||
'product_uom_qty': self.scrap_qty,
|
||||
|
||||
Reference in New Issue
Block a user