summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-02-11 13:45:07 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-02-11 13:45:07 +0700
commit751645803b13cbc96d4a554a9c9d8a63cd991486 (patch)
tree18716a66fa33b1a9cb7ae5e3945bc0e571a6b595
parent597e3b3f62d492f0bb113138decc130477f89ed6 (diff)
fix bug state reserve
-rw-r--r--indoteknik_custom/models/stock_picking.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index ce198be3..b1b1bdb8 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -467,19 +467,19 @@ class StockPicking(models.Model):
def check_state_reserve(self):
pickings = self.search([
- ('state', 'not in', ['cancel', 'done']),
+ ('state', 'not in', ['cancel', 'draft', 'done']),
('picking_type_code', '=', 'outgoing')
])
for picking in pickings:
- fullfillments = self.env['sales.order.fullfillment'].search([
- ('sales_order_id', '=', picking.sale_id.id)
+ fullfillments = self.env['sales.order.fulfillment.v2'].search([
+ ('sale_order_id', '=', picking.sale_id.id)
])
picking.state_reserve = 'ready'
picking.date_reserved = picking.date_reserved or datetime.datetime.utcnow()
- if any(rec.reserved_from not in ['Inventory On Hand', 'Reserved from stock', 'Free Stock'] for rec in fullfillments):
+ if any(rec.so_qty != rec.reserved_stock_qty for rec in fullfillments):
picking.state_reserve = 'waiting'
picking.date_reserved = ''