From b87ad37ce3f5ba0f3fb0f7613755fd000ffed8fa Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 14 Aug 2025 18:12:35 +0700 Subject: doesnt allow user create from tree --- indoteknik_custom/views/tukar_guling_po.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/views/tukar_guling_po.xml b/indoteknik_custom/views/tukar_guling_po.xml index 1c6a86ea..548a209f 100644 --- a/indoteknik_custom/views/tukar_guling_po.xml +++ b/indoteknik_custom/views/tukar_guling_po.xml @@ -21,7 +21,7 @@ pengajuan.tukar.guling.po.tree tukar.guling.po - + -- cgit v1.2.3 From 4e1d5fa01a64bc6daa6c7bf7255caa55ccf53c59 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 14 Aug 2025 18:28:26 +0700 Subject: Vals already returned --- indoteknik_custom/models/tukar_guling_po.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py index cc1c79c0..94771f37 100644 --- a/indoteknik_custom/models/tukar_guling_po.py +++ b/indoteknik_custom/models/tukar_guling_po.py @@ -435,6 +435,15 @@ class TukarGulingPO(models.Model): if bu_put: raise UserError("❌ Tidak bisa retur BU/INPUT karena BU/PUT sudah Done!") + existing_tukar_guling = self.env['tukar.guling.po'].search([ + ('operations', '=', self.operations.id), + ('id', '!=', self.id), + ('state', '!=', 'cancel'), + ], limit=1) + + if existing_tukar_guling: + raise UserError("BU ini sudah pernah diretur oleh dokumen %s." % existing_tukar_guling.name) + picking = self.operations pick_id = self.operations.picking_type_id.id if pick_id == 75: -- cgit v1.2.3