From fec7e22368ca2b22d8a36a34fed7d40d2848ad0b Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 23 Oct 2025 09:05:14 +0700 Subject: push --- indoteknik_custom/models/stock_move.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index e7ea8fd5..6622359d 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -270,28 +270,28 @@ class StockMoveLine(models.Model): total_qty = line.move_id.product_uom_qty or 0 done_qty = line.qty_done or 0 - # Hitung sisa qty line.outstanding_qty = max(total_qty - done_qty, 0) if total_qty == 0: continue - # 🟢 full if done_qty >= total_qty: line.delivery_status = 'full' + elif done_qty < total_qty: + line.delivery_status = 'partial' - # 🟡 partial elif 0 < done_qty < total_qty: - # cek apakah masih ada backorder untuk picking ini backorder_exists = self.env['stock.picking'].search_count([ - ('backorder_id', '=', line.picking_id.id), - ('state', 'not in', ('done', 'cancel')) + ('group_id', '=', line.picking_id.group_id.id), + ('name', 'ilike', 'BU/OUT'), + ('id', '!=', line.picking_id.id), + ('state', 'in', ['done', 'assigned']), ]) + if backorder_exists: line.delivery_status = 'partial' - else: - # 🔴 partial_final - line.delivery_status = 'partial_final' + if done_qty >= total_qty: + line.delivery_status = 'partial_final' # Ambil uom dari stock move @api.model -- cgit v1.2.3