From f316cfaaf269cf57488bbfae027df95f83a6ec28 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Sat, 5 Jul 2025 08:40:34 +0700 Subject: fix sequence and return --- indoteknik_custom/models/tukar_guling_po.py | 39 +++++++++++------------------ indoteknik_custom/views/ir_sequence.xml | 2 +- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py index 92a58d21..f885017c 100644 --- a/indoteknik_custom/models/tukar_guling_po.py +++ b/indoteknik_custom/models/tukar_guling_po.py @@ -418,40 +418,31 @@ class TukarGulingPO(models.Model): return return_picking - if record.operations.picking_typ_id.id == 28: - bu_prt = _create_return_from_picking(record.operations) - if bu_prt: - created_returns.append(bu_prt) - # Eksekusi sesuai kondisi operations - if record.operations.picking_type_id.id == 76: - # Kalau operations = PRT → return jadi BU INPUT - bu_input = _create_return_from_picking(record.operations) - if bu_input: - created_returns.append(bu_input) - elif record.operations.picking_type_id.id == 77: - # Kalau operations = VRT → return jadi BU PUT - bu_put = _create_return_from_picking(record.operations) - if bu_put: - created_returns.append(bu_put) - else: - # Standard: retur bu_input & bu_put - prt = _create_return_from_picking(bu_input_to_return) + if record.operations.picking_type_id.id == 28: + prt = _create_return_from_picking(record.operations) if prt: created_returns.append(prt) - + else: vrt = _create_return_from_picking(bu_put_to_return) if vrt: created_returns.append(vrt) - if record.return_type == 'tukar_guling': - vrt = _create_return_from_picking(bu_put_to_return) - if vrt: - created_returns.append(vrt) - + prt = None + if bu_input_to_return: prt = _create_return_from_picking(bu_input_to_return) if prt: created_returns.append(prt) + if record.return_type == 'tukar_guling': + if prt: + bu_input = _create_return_from_picking(prt) + if bu_input: + created_returns.append(bu_input) + if vrt: + bu_put = _create_return_from_picking(vrt) + if bu_put: + created_returns.append(bu_put) + if not created_returns: raise UserError("Tidak ada dokumen retur yang berhasil dibuat.") diff --git a/indoteknik_custom/views/ir_sequence.xml b/indoteknik_custom/views/ir_sequence.xml index 3cc43c05..b02e927a 100644 --- a/indoteknik_custom/views/ir_sequence.xml +++ b/indoteknik_custom/views/ir_sequence.xml @@ -198,7 +198,7 @@ 1 1 - + Pengajuan Return PO tukar.guling.po VCM -- cgit v1.2.3