diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-01-23 16:22:51 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-01-23 16:22:51 +0700 |
| commit | 3cddf493a9eb2ac709a679ff9580eaffdd88e29c (patch) | |
| tree | d7853b15653742809b81b472cf5c5874567cc180 | |
| parent | 5aca322a18fcf09becaa74aba12666fd776f3559 (diff) | |
change logic credit limit for parent company
| -rwxr-xr-x | base_accounting_kit/models/credit_limit.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/base_accounting_kit/models/credit_limit.py b/base_accounting_kit/models/credit_limit.py index d290fe5..080a901 100755 --- a/base_accounting_kit/models/credit_limit.py +++ b/base_accounting_kit/models/credit_limit.py @@ -155,11 +155,17 @@ class SaleOrder(models.Model): # paid_invoice_amount += invoice.amount_total outstanding_amount = rec.outstanding_amount - + check_credit_limit = False ###### block_stage = 0 - if rec.partner_id.active_limit \ - and rec.partner_id.enable_credit_limit: + if rec.partner_id.parent_id: + if rec.partner_id.parent_id.active_limit and rec.partner_id.parent_id.enable_credit_limit: + check_credit_limit = True + else: + if rec.partner_id.active_limit and rec.partner_id.enable_credit_limit: + check_credit_limit = True + + if check_credit_limit: if rec.partner_id.parent_id: block_stage = rec.partner_id.parent_id.blocking_stage or 0 else: |
