summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_custom/models/tukar_guling_po.py39
-rw-r--r--indoteknik_custom/views/ir_sequence.xml2
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>