summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorArnaud Baes <arb@odoo.com>2019-09-09 12:39:29 +0000
committerArnaud Baes <arb@odoo.com>2019-09-09 12:39:29 +0000
commitef30bd438ca80cfdcd6baad9b6db48f2c7d8282d (patch)
treec6751ab960f512dcaaa4daaa1643fb7b4a8b52ad /addons
parentcc8994a4ef51dbf4a2e938e58bec11416038ed56 (diff)
[FIX] stock: preserve context in scrap wizards
Context was overwritten in the wizard warning for insufficient quantity when trying to scrap a componenent from a MO. This had a side-effect on the move creation of the scrap where the move was not linked to the MO, thus ignored by the cost analysis report. closes odoo/odoo#36563 Tasks: BugLogistics Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/stock/models/stock_scrap.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/addons/stock/models/stock_scrap.py b/addons/stock/models/stock_scrap.py
index 2e7d6eb021e..5ad0a297093 100644
--- a/addons/stock/models/stock_scrap.py
+++ b/addons/stock/models/stock_scrap.py
@@ -166,17 +166,19 @@ class StockScrap(models.Model):
if float_compare(available_qty, scrap_qty, precision_digits=precision) >= 0:
return self.do_scrap()
else:
+ ctx = dict(self.env.context)
+ ctx.update({
+ 'default_product_id': self.product_id.id,
+ 'default_location_id': self.location_id.id,
+ 'default_scrap_id': self.id
+ })
return {
'name': _('Insufficient Quantity'),
'view_mode': 'form',
'res_model': 'stock.warn.insufficient.qty.scrap',
'view_id': self.env.ref('stock.stock_warn_insufficient_qty_scrap_form_view').id,
'type': 'ir.actions.act_window',
- 'context': {
- 'default_product_id': self.product_id.id,
- 'default_location_id': self.location_id.id,
- 'default_scrap_id': self.id
- },
+ 'context': ctx,
'target': 'new'
}