diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-05 08:40:34 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-05 08:40:34 +0700 |
| commit | f316cfaaf269cf57488bbfae027df95f83a6ec28 (patch) | |
| tree | 57fa4f5dfe33b84a7d082ca472a513e93f82ee53 | |
| parent | 43b88a8d7814281e4e20c3a22c0c1780e4caf54e (diff) | |
<miqdad> fix sequence and return
| -rw-r--r-- | indoteknik_custom/models/tukar_guling_po.py | 39 | ||||
| -rw-r--r-- | 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 @@ <field name="number_next">1</field> <field name="number_increment">1</field> </record> - <record id="seq_tukar_guling" model="ir.sequence"> + <record id="seq_tukar_guling_po" model="ir.sequence"> <field name="name">Pengajuan Return PO</field> <field name="code">tukar.guling.po</field> <field name="prefix">VCM</field> |
