From aedf25e194d4ddddab9b158b473164151109edaf Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 9 Jul 2025 10:16:19 +0700 Subject: rev 77 vals bu input --- indoteknik_custom/models/tukar_guling_po.py | 7 +++++++ indoteknik_custom/views/tukar_guling_po.xml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py index e9dfda33..aa8fd1f3 100644 --- a/indoteknik_custom/models/tukar_guling_po.py +++ b/indoteknik_custom/models/tukar_guling_po.py @@ -239,6 +239,13 @@ class TukarGulingPO(models.Model): def write(self, vals): self._check_bill_on_revisi_po() + tipe = vals.get('return_type', self.return_type) + + + if self.operations.picking_type_id.id == 28 and tipe == 'tukar_guling': + raise UserError("❌ BU/INPUT tidak boleh di retur tukar guling") + + if self.operations.picking_type_id.id != 28: if self._is_already_returned(self.operations): raise UserError("BU ini sudah pernah diretur oleh dokumen lain.") diff --git a/indoteknik_custom/views/tukar_guling_po.xml b/indoteknik_custom/views/tukar_guling_po.xml index 6e13eee2..0e29e965 100644 --- a/indoteknik_custom/views/tukar_guling_po.xml +++ b/indoteknik_custom/views/tukar_guling_po.xml @@ -50,7 +50,7 @@ attrs="{'invisible': [('state', 'not in', ['approval_purchase', 'approval_logistic', 'approval_finance'])]}"/>