diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-09 13:14:59 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-09 13:14:59 +0700 |
| commit | 717dbfa7070e94c0af2bb39e2cebb4dc71d123b9 (patch) | |
| tree | 9db580d9b6e5d005f2b3b98ade10b25e079aa1ea /indoteknik_custom/models/tukar_guling.py | |
| parent | aedf25e194d4ddddab9b158b473164151109edaf (diff) | |
<miqdad> rev 77 vals vals
Diffstat (limited to 'indoteknik_custom/models/tukar_guling.py')
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index e2f68e6c..5762abbb 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -270,9 +270,7 @@ class TukarGuling(models.Model): else: _logger.info("hehhe") - # if self.operations.picking_type_id.id != 30: - # if self._is_already_returned(self.operations): - # raise UserError("BU ini sudah pernah diretur oleh dokumen lain.") + if 'operations' in vals and not vals.get('origin'): picking = self.env['stock.picking'].browse(vals['operations']) if picking.origin: @@ -330,9 +328,8 @@ class TukarGuling(models.Model): linked_bu_out = picking.linked_manual_bu_out if linked_bu_out and linked_bu_out.state == 'done': raise UserError("❌ Tidak bisa retur BU/PICK karena BU/OUT suda Done!") - if self.operations.picking_type_id.id != 30: - if self._is_already_returned(self.operations): - raise UserError("BU ini sudah pernah diretur oleh dokumen lain.") + if self._is_already_returned(self.operations): + raise UserError("BU ini sudah pernah diretur oleh dokumen lain.") self._check_invoice_on_revisi_so() self._validate_product_lines() @@ -527,10 +524,12 @@ class TukarGuling(models.Model): return return_picking + # CASE: Kalau retur BU/PICK jadi ort saja if record.operations.picking_type_id.id == 30: ort = _create_return_from_picking(record.operations) if ort: created_returns.append(ort) + # Kalau retur BU/OUT else: # CASE: Retur dari BU/OUT srt = _create_return_from_picking(bu_out_to_return) |
