[FIX] stock: scrap wrong issuficient quantity wizard

revert commit 72c36aaf90 due to commit 47219e96e1
First commit is now useless and on top of that it ignores the putaway
strategies.

opw-2412699

closes odoo/odoo#64200

X-original-commit: a8db48244f069f9f29ee1120862bdf2c03ec26dd
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit is contained in:
Arnold Moyaux
2021-01-07 11:13:30 +00:00
committed by Goffin Simon
parent e131028dec
commit 72d43fdf9f
+3 -9
View File
@@ -103,9 +103,6 @@ class StockScrap(models.Model):
def _prepare_move_values(self):
self.ensure_one()
location_id = self.location_id.id
if self.picking_id and self.picking_id.picking_type_code == 'incoming':
location_id = self.picking_id.location_dest_id.id
return {
'name': self.name,
'origin': self.origin or self.picking_id.name or self.name,
@@ -114,13 +111,13 @@ class StockScrap(models.Model):
'product_uom': self.product_uom_id.id,
'state': 'draft',
'product_uom_qty': self.scrap_qty,
'location_id': location_id,
'location_id': self.location_id.id,
'scrapped': True,
'location_dest_id': self.scrap_location_id.id,
'move_line_ids': [(0, 0, {'product_id': self.product_id.id,
'product_uom_id': self.product_uom_id.id,
'qty_done': self.scrap_qty,
'location_id': location_id,
'location_id': self.location_id.id,
'location_dest_id': self.scrap_location_id.id,
'package_id': self.package_id.id,
'owner_id': self.owner_id.id,
@@ -155,11 +152,8 @@ class StockScrap(models.Model):
if self.product_id.type != 'product':
return self.do_scrap()
precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')
location_id = self.location_id
if self.picking_id and self.picking_id.picking_type_code == 'incoming':
location_id = self.picking_id.location_dest_id
available_qty = sum(self.env['stock.quant']._gather(self.product_id,
location_id,
self.location_id,
self.lot_id,
self.package_id,
self.owner_id,