From f5e99060b66dd62d8154c07f1110bf1c913a1424 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 26 Mar 2019 09:32:43 +0000 Subject: [PATCH] [FIX] stock: discard scrap - Process a WO (e.g. 'Manual Assembly' from the demo data) - Create a scrap for component 'Drawer Black' - A new wizard appears: 'The product XXX is not available in sufficient quantity' - Click on 'Discard' A scrap is created in draft, but it cannot be canceled. The scrap shouldn't have been created in a first place, but this cannot be changed in stable. Therefore, we delete it. opw-1946254 closes odoo/odoo#32122 Signed-off-by: Nicolas Martinelli (nim) --- addons/stock/wizard/stock_warn_insufficient_qty.py | 4 ++++ addons/stock/wizard/stock_warn_insufficient_qty_views.xml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/addons/stock/wizard/stock_warn_insufficient_qty.py b/addons/stock/wizard/stock_warn_insufficient_qty.py index 50247d130bf49..3e480c73e83e2 100644 --- a/addons/stock/wizard/stock_warn_insufficient_qty.py +++ b/addons/stock/wizard/stock_warn_insufficient_qty.py @@ -34,3 +34,7 @@ class StockWarnInsufficientQtyScrap(models.TransientModel): def action_done(self): return self.scrap_id.do_scrap() + + def action_cancel(self): + # FIXME in master: we should not have created the scrap in a first place + return self.scrap_id.sudo().unlink() diff --git a/addons/stock/wizard/stock_warn_insufficient_qty_views.xml b/addons/stock/wizard/stock_warn_insufficient_qty_views.xml index f6fb8eee99ed1..01de1f8e4825b 100644 --- a/addons/stock/wizard/stock_warn_insufficient_qty_views.xml +++ b/addons/stock/wizard/stock_warn_insufficient_qty_views.xml @@ -44,6 +44,9 @@ + +