[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:
Darshil Trivedi
2018-08-16 15:14:54 +02:00
committed by Simon Lejeune
parent 7d898ad72f
commit 69dd3dfa90
+2
View File
@@ -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,