diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-01-10 12:01:05 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-01-10 12:01:05 +0700 |
| commit | b352a2c5f5899f7e8e46fbf728fb387efdda0fb7 (patch) | |
| tree | 897f7cb90d075b6016fc1934bc4677eaf239b250 | |
| parent | f80e95677fc8144e09830f619a08814928cf3fad (diff) | |
<MIqdad> balikin approval pimpinan PO
| -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: |
