diff options
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) |
