diff options
| author | FIN-IT_AndriFP <it@fixcomart.co.id> | 2025-10-17 15:45:48 +0700 |
|---|---|---|
| committer | FIN-IT_AndriFP <it@fixcomart.co.id> | 2025-10-17 15:45:48 +0700 |
| commit | 2cd0d5ede34e2c46b3bcd1f1907cd0526ef42b9d (patch) | |
| tree | 0e3d022b848cb74348521de05a632de1f66f1341 /indoteknik_custom/models/purchase_order.py | |
| parent | 66983246c83db072c62abba4a40a70e514b081d0 (diff) | |
(andri) butuh approval pimpinan bila ada perubahan unit price pada PO PJ + matches SO margin header <=15%
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 6 |
1 files changed, 4 insertions, 2 deletions
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: |
