diff options
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 7557045f..a114743f 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1079,18 +1079,18 @@ class PurchaseOrder(models.Model): ) % order.name) def button_confirm(self): - # if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan - # if '/PJ/' in self.name: - # price_change_detected = any(line.price_unit_before for line in self.order_line) - # if price_change_detected: - # if self.total_percent_margin <= 15.0: - # raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") - # else: - # low_margin_match_so = self.order_sales_match_line.filtered( - # lambda match: match.so_header_margin <= 15.0 - # ) - # if low_margin_match_so: - # raise UserError("Approval Pimpinan diperlukan jika pada PO Line yang Matches SO item memiliki header margin SO <= 15%") + if self.env.user.id != 7 and not self.env.user.is_leader: # Pimpinan + if '/PJ/' in self.name: + price_change_detected = any(line.price_unit_before for line in self.order_line) + if price_change_detected: + if self.total_percent_margin <= 15.0: + raise UserError("Approval Pimpinan diperlukan jika terdapat perubahan Unit Price pada PO Line dan Memiliki Margin <= 15%") + else: + low_margin_match_so = self.order_sales_match_line.filtered( + lambda match: match.so_header_margin <= 15.0 + ) + if low_margin_match_so: + raise UserError("Approval Pimpinan diperlukan jika 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: |
