diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-10-23 09:05:14 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-10-23 09:05:14 +0700 |
| commit | fec7e22368ca2b22d8a36a34fed7d40d2848ad0b (patch) | |
| tree | d21a64f189e840abecdee4e771fc004dbe361980 | |
| parent | 4a7dd26f06d2d59768724dd13350f8aa1f0719f5 (diff) | |
push
| -rw-r--r-- | indoteknik_custom/models/stock_move.py | 18 |
1 files 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 |
