From a7a50ce0f4b80bf37c5abf8ba0f22ef1e2eeaf18 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 15 Jan 2024 13:25:50 +0700 Subject: fix iu minus inventory validation --- indoteknik_custom/models/stock_picking.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index cebd5fc1..c98b5f99 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -282,16 +282,22 @@ class StockPicking(models.Model): return def validation_minus_onhand_quantity(self): - bu_location_id = 57 + bu_location_id = 49 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), ]) - if self.sale_id and quant and quant.inventory_quantity < line.product_uom_qty: + if ( + self.picking_type_id.id == 29 + and quant + and line.location_id.id == bu_location_id + and quant.inventory_quantity < line.product_uom_qty + ): raise UserError('Quantity reserved lebih besar dari quantity onhand di product') + def button_validate(self): if self._name != 'stock.picking': return super(StockPicking, self).button_validate() -- cgit v1.2.3