diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-08 09:06:49 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-08 09:06:49 +0700 |
| commit | 53cb341f8184c3d74434f2b2d18d1bd984b57118 (patch) | |
| tree | e6b5dabbdc42a5d2d9c0070587babbeff97b894d | |
| parent | de72aa77b725cda13a5cf208b7b940599fa9f6f9 (diff) | |
cr po and validasi so
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 4 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 13 |
2 files changed, 13 insertions, 4 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index ef2fdb5b..08408506 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -504,7 +504,7 @@ class PurchaseOrder(models.Model): self.check_ppn_mix() # self.check_data_vendor() - if self.amount_untaxed >= 10000000 and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): + if self.amount_untaxed >= 50000000 and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): raise UserError("Hanya Merchandiser yang bisa approve") if self.total_percent_margin < self.total_so_percent_margin and not self.env.user.is_purchasing_manager and not self.env.user.is_leader: @@ -637,7 +637,7 @@ class PurchaseOrder(models.Model): template.send_mail(self.id, force_send=True) def po_approve(self): - if self.amount_untaxed >= 10000000 and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): + if self.amount_untaxed >= 50000000 and not self.env.user.has_group('indoteknik_custom.group_role_merchandiser'): raise UserError("Hanya Merchandiser yang bisa approve") if self.env.user.is_leader or self.env.user.is_purchasing_manager: raise UserError("Bisa langsung Confirm") diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 2cef531e..d56a7946 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -727,10 +727,14 @@ class SaleOrder(models.Model): for order in self: order.order_line.validate_line() + term_days = 0 + for term_line in order.payment_term_id.line_ids: + term_days += term_line.days + partner = order.partner_id.parent_id or order.partner_id if not partner.property_payment_term_id: raise UserError("Payment Term pada Master Data Customer harus diisi") - if not partner.active_limit and order.payment_term_id.id not in [27, 26]: + if not partner.active_limit and term_days > 0: raise UserError("Credit Limit pada Master Data Customer harus diisi") if order.payment_term_id != partner.property_payment_term_id: raise UserError("Payment Term berbeda pada Master Data Customer") @@ -752,10 +756,15 @@ class SaleOrder(models.Model): for order in self: order.order_line.validate_line() + + term_days = 0 + for term_line in order.payment_term_id.line_ids: + term_days += term_line.days + partner = order.partner_id.parent_id or order.partner_id if not partner.property_payment_term_id: raise UserError("Payment Term pada Master Data Customer harus diisi") - if not partner.active_limit and order.payment_term_id.id not in [27, 26]: + if not partner.active_limit and term_days > 0: raise UserError("Credit Limit pada Master Data Customer harus diisi") if order.payment_term_id != partner.property_payment_term_id: raise UserError("Payment Term berbeda pada Master Data Customer") |
