From b2f39b75e96ef7c80f32ddd7cec86de1eb6c7279 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 17 Feb 2025 08:54:23 +0700 Subject: add logic if cbd not validasi limit --- indoteknik_custom/models/sale_order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 9631fe6e..8a851a69 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -942,6 +942,7 @@ class SaleOrder(models.Model): # Ambil blocking stage dari partner block_stage = rec.partner_id.parent_id.blocking_stage if rec.partner_id.parent_id else rec.partner_id.blocking_stage or 0 + is_cbd = rec.partner_id.parent_id.property_payment_term_id.id == 26 if rec.partner_id.parent_id else rec.partner_id.property_payment_term_id.id == 26 or False # Ambil jumlah nilai dari SO yang invoice_status masih 'to invoice' so_to_invoice = 0 @@ -952,7 +953,7 @@ class SaleOrder(models.Model): remaining_credit_limit = block_stage - current_total - so_to_invoice # Validasi limit - if remaining_credit_limit <= 0 and block_stage > 0: + if remaining_credit_limit <= 0 and block_stage > 0 and not is_cbd: raise UserError(_("The credit limit for %s will exceed the Blocking Stage if the Sale Order is confirmed. The remaining credit limit is %s, from %s and the outstanding amount is %s.") % (rec.partner_id.name, block_stage - current_total, block_stage, outstanding_amount)) -- cgit v1.2.3