From 2cd0d5ede34e2c46b3bcd1f1907cd0526ef42b9d Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Fri, 17 Oct 2025 15:45:48 +0700 Subject: (andri) butuh approval pimpinan bila ada perubahan unit price pada PO PJ + matches SO margin header <=15% --- indoteknik_custom/models/purchase_order.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom/models/purchase_order.py') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 701c0a3f..51517437 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1074,8 +1074,10 @@ class PurchaseOrder(models.Model): low_margin_lines = self.order_sales_match_line.filtered( lambda match: match.so_header_margin <= 15.0 ) - if low_margin_lines: - raise UserError("Matches SO terdapat item dengan header margin SO <= 15%. Approval Pimpinan diperlukan.") + price_change_detected = any(line.price_unit_before for line in self.order_line) + if low_margin_lines and price_change_detected: + # raise UserError("Matches SO terdapat item dengan header margin SO <= 15%. Approval Pimpinan diperlukan.") + raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line yang Matches SO item memiliki header margin SO <= 15%") # else: # is_po_manual = '/A/' not in self.name and '/MO/' not in self.name # if is_po_manual: -- cgit v1.2.3