diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml
index ba509c970c7..562fa29bd26 100644
--- a/addons/mrp/mrp_view.xml
+++ b/addons/mrp/mrp_view.xml
@@ -701,11 +701,6 @@
-
@@ -724,10 +719,6 @@
string="Partial"
type="action" states="confirmed,assigned"
icon="gtk-justify-fill"/>
-
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 1e85d2f29e5..20bc6307b15 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -2475,13 +2475,20 @@ class stock_move(osv.osv):
raise osv.except_osv(_('Warning!'), _('Please provide a positive quantity to scrap.'))
res = []
for move in self.browse(cr, uid, ids, context=context):
+ source_location = move.location_id
+ if move.state == 'done':
+ source_location = move.location_dest_id
+ if source_location.usage != 'internal':
+ #restrict to scrap from a virtual location because it's meaningless and it may introduce errors in stock ('creating' new products from nowhere)
+ raise osv.except_osv(_('Error!'), _('Forbidden operation: it is not allowed to scrap products from a virtual location.'))
move_qty = move.product_qty
uos_qty = quantity / move_qty * move.product_uos_qty
default_val = {
+ 'location_id': source_location.id,
'product_qty': quantity,
'product_uos_qty': uos_qty,
'state': move.state,
- 'scrapped' : True,
+ 'scrapped': True,
'location_dest_id': location_id,
'tracking_id': move.tracking_id.id,
'prodlot_id': move.prodlot_id.id,