From 283baf2945adfbadaddd9fb0ca732df894189062 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 12 Jan 2024 15:42:16 +0700 Subject: fix validation iu minus on inventory --- indoteknik_custom/models/stock_picking.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 0c810ef7..f6a21698 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -286,10 +286,10 @@ class StockPicking(models.Model): for line in self.move_line_ids_without_package: quant = self.env['stock.quant'].search([ ('product_id', '=', line.product_id.id), - ('location_id', '=', bu_location_id) + ('location_id', '=', bu_location_id), ]) - if quant and quant.inventory_quantity < line.product_uom_qty: + if self.sale_id and quant and quant.inventory_quantity < line.product_uom_qty: raise UserError('Quantity reserved lebih besar dari quantity onhand di product') def button_validate(self): -- cgit v1.2.3