summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-01-15 13:25:50 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-01-15 13:25:50 +0700
commita7a50ce0f4b80bf37c5abf8ba0f22ef1e2eeaf18 (patch)
tree4ffa1c27a63c787cbcf922f3d7c8f22c0294f7ec
parent7c348d0bd0f6e31c00351629f0c8cb6f36735f60 (diff)
fix iu minus inventory validation
-rw-r--r--indoteknik_custom/models/stock_picking.py10
1 files 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()