Skip to content

Commit

Permalink
[FIX] stock: discard scrap
Browse files Browse the repository at this point in the history
- 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 #32122

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
  • Loading branch information
nim-odoo committed Mar 26, 2019
1 parent 80b900e commit f5e9906
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions addons/stock/wizard/stock_warn_insufficient_qty.py
Expand Up @@ -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()
3 changes: 3 additions & 0 deletions addons/stock/wizard/stock_warn_insufficient_qty_views.xml
Expand Up @@ -44,6 +44,9 @@
<xpath expr="//field[@name='product_id']" position="after">
<field name="scrap_id" invisible="1"/>
</xpath>
<xpath expr="//button[@name='cancel_button']" position="replace">
<button string="Discard" name="action_cancel" type="object" class="btn-primary"/>
</xpath>
</field>
</record>
</odoo>

0 comments on commit f5e9906

Please sign in to comment.