diff options
| author | Arnaud Baes <arb@odoo.com> | 2019-09-09 12:39:29 +0000 |
|---|---|---|
| committer | Arnaud Baes <arb@odoo.com> | 2019-09-09 12:39:29 +0000 |
| commit | ef30bd438ca80cfdcd6baad9b6db48f2c7d8282d (patch) | |
| tree | c6751ab960f512dcaaa4daaa1643fb7b4a8b52ad /addons | |
| parent | cc8994a4ef51dbf4a2e938e58bec11416038ed56 (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.py | 12 |
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' } |
