summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-07-06 16:55:03 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-07-06 16:55:03 +0700
commit8ae9c244aa06c07d3723cf7a330125bc743c7533 (patch)
treec8346074417901967de19b312ca55b6088cb8622
parentcc527a815d16bdd6a78874959a63b3a5bd113807 (diff)
if purchase_ok false then cant running action confirm on po
-rwxr-xr-xindoteknik_custom/models/purchase_order.py3
1 files changed, 3 insertions, 0 deletions
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'