[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:
Josse Colpaert
2016-09-28 12:38:13 +02:00
parent 88e379cd27
commit 31b3073d4b
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -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:
+1 -1
View File
@@ -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,