diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2024-09-03 16:38:22 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2024-09-03 16:38:22 +0700 |
| commit | 1dbb07dbf4e45ebd681b439eae5de4e891e9d801 (patch) | |
| tree | c751b8150823e837d42a8a3aa06b3022eab9c84b | |
| parent | e6e50dd2a1d8552ce75b733bd2eb8cdcb9e76e94 (diff) | |
change validation of credit limit
| -rwxr-xr-x | base_accounting_kit/models/credit_limit.py | 12 | ||||
| -rwxr-xr-x | base_accounting_kit/views/credit_limit_view.xml | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/base_accounting_kit/models/credit_limit.py b/base_accounting_kit/models/credit_limit.py index 080a901..5d37675 100755 --- a/base_accounting_kit/models/credit_limit.py +++ b/base_accounting_kit/models/credit_limit.py @@ -71,6 +71,12 @@ class ResPartner(models.Model): class SaleOrder(models.Model): _inherit = 'sale.order' + approval_status = fields.Selection([ + ('pengajuan1', 'Approval Manager'), + ('pengajuan2', 'Approval Pimpinan'), + ('approved', 'Approved'), + ], string='Approval Status', readonly=True, copy=False, index=True, tracking=3) + def _get_outstanding_amount(self): for rec in self: if not rec.id: @@ -165,6 +171,12 @@ class SaleOrder(models.Model): if rec.partner_id.active_limit and rec.partner_id.enable_credit_limit: check_credit_limit = True + term_days = 0 + for term_line in rec.payment_term_id.account_payment_term_line: + term_days += term_line.days + if term_days == 0: + check_credit_limit = False + if check_credit_limit: if rec.partner_id.parent_id: block_stage = rec.partner_id.parent_id.blocking_stage or 0 diff --git a/base_accounting_kit/views/credit_limit_view.xml b/base_accounting_kit/views/credit_limit_view.xml index 17d0b34..a0f215b 100755 --- a/base_accounting_kit/views/credit_limit_view.xml +++ b/base_accounting_kit/views/credit_limit_view.xml @@ -28,6 +28,7 @@ <field name="has_due" invisible="1"/> <field name="is_warning" invisible="1"/> <field name="outstanding_amount" invisible="1"/> + <field name="approval_status"/> </xpath> <xpath expr="//header" position="after"> <div class="alert alert-info" role="alert" style="height: 40px; margin-bottom:0px;" |
