From 8ae9c244aa06c07d3723cf7a330125bc743c7533 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 6 Jul 2023 16:55:03 +0700 Subject: if purchase_ok false then cant running action confirm on po --- indoteknik_custom/models/purchase_order.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 13ff2931..1eb76370 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -191,6 +191,9 @@ class PurchaseOrder(models.Model): raise UserError("Beda Margin dengan Sales, harus approval Manager") if not self.sale_order_id and not self.env.user.is_purchasing_manager and not self.env.user.is_leader: raise UserError("Tidak ada link dengan SO, harus approval Manager") + for line in self.order_line: + if not line.product_id.purchase_ok: + raise UserError("Terdapat barang yang tidak bisa di proses") self.approval_status = 'approved' self.po_status = 'menunggu' -- cgit v1.2.3