[FIX] stock: scrap: bypass confirmation wizard if not storable
If a user wants to scrap more quantity than he has in stock, we return to him a confirmation wizard. This doesn't make sense when scrapping consumables products, as there are no quants for these kind of products. task 1864026
This commit is contained in:
committed by
Simon Lejeune
parent
7d898ad72f
commit
69dd3dfa90
@@ -121,6 +121,8 @@ class StockScrap(models.Model):
|
||||
|
||||
def action_validate(self):
|
||||
self.ensure_one()
|
||||
if self.product_id.type != 'product':
|
||||
return self.do_scrap()
|
||||
precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')
|
||||
available_qty = sum(self.env['stock.quant']._gather(self.product_id,
|
||||
self.location_id,
|
||||
|
||||
Reference in New Issue
Block a user