summaryrefslogtreecommitdiff
path: root/base_accounting_kit/models/credit_limit.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-09-03 16:38:22 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-09-03 16:38:22 +0700
commit1dbb07dbf4e45ebd681b439eae5de4e891e9d801 (patch)
treec751b8150823e837d42a8a3aa06b3022eab9c84b /base_accounting_kit/models/credit_limit.py
parente6e50dd2a1d8552ce75b733bd2eb8cdcb9e76e94 (diff)
change validation of credit limit
Diffstat (limited to 'base_accounting_kit/models/credit_limit.py')
-rwxr-xr-xbase_accounting_kit/models/credit_limit.py12
1 files changed, 12 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