summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndriFP <andrifebriyadiputra@gmail.com>2025-04-23 11:53:12 +0700
committerAndriFP <andrifebriyadiputra@gmail.com>2025-04-23 11:53:12 +0700
commitf3854677b0f74db2fbb54ad012b3a6a6fc9e11df (patch)
treee4c10c96e9257bcadf13528cdda1a8fd429e11cb
parent30382037882e15bb43f56fc0d81500faeb364fa5 (diff)
(andri) fix notify ganda pada PO
-rwxr-xr-xindoteknik_custom/models/purchase_order.py39
1 files changed, 19 insertions, 20 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 60d26105..98b367d0 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -152,7 +152,7 @@ class PurchaseOrder(models.Model):
if not minimum_tax or not order.order_line:
continue
- if order.amount_untaxed < minimum_tax:
+ if order.amount_total < minimum_tax:
_logger.info(">>> Total di bawah minimum → apply No Tax")
for line in order.order_line:
line.taxes_id = [(6, 0, [no_tax.id])]
@@ -162,7 +162,6 @@ class PurchaseOrder(models.Model):
message="Total belanja PO belum mencapai minimum pajak vendor. "
"Pajak diganti menjadi 'No Tax'.",
title="Pajak Diperbarui",
- sticky=True
)
else:
_logger.info(">>> Total memenuhi minimum → apply Pajak 11%")
@@ -174,27 +173,27 @@ class PurchaseOrder(models.Model):
message="Total belanja sebelum pajak telah memenuhi minimum. "
"Pajak 11%% diterapkan",
title="Pajak Diperbarui",
- sticky=True
)
- @api.onchange('order_line')
- def _onchange_order_line_tax_default(self):
- _logger.info("Onchange Order Line Tax Default Terpanggil")
+ # set default no_tax pada order line
+ # @api.onchange('order_line')
+ # def _onchange_order_line_tax_default(self):
+ # _logger.info("Onchange Order Line Tax Default Terpanggil")
- no_tax = self.env['account.tax'].search([
- ('type_tax_use', '=', 'purchase'),
- ('name', 'ilike', 'no tax')
- ], limit=1)
+ # no_tax = self.env['account.tax'].search([
+ # ('type_tax_use', '=', 'purchase'),
+ # ('name', 'ilike', 'no tax')
+ # ], limit=1)
- if not no_tax:
- _logger.info("No Tax tidak ditemukan")
- return
+ # if not no_tax:
+ # _logger.info("No Tax tidak ditemukan")
+ # return
- for order in self:
- for line in order.order_line:
- if not line.taxes_id:
- line.taxes_id = [(6, 0, [no_tax.id])]
- _logger.info("Auto-set No tax ke baris product: %s", line.product_id.name)
+ # for order in self:
+ # for line in order.order_line:
+ # if not line.taxes_id:
+ # line.taxes_id = [(6, 0, [no_tax.id])]
+ # _logger.info("Auto-set No tax ke baris product: %s", line.product_id.name)
@api.onchange('total_cost_service')
def _onchange_total_cost_service(self):
@@ -1190,8 +1189,8 @@ class PurchaseOrder(models.Model):
@api.model #override custom create & write for check payment term
def create(self, vals):
order = super().create(vals)
- order.with_context(skip_check_payment=True)._check_payment_term()
- order.with_context(notify_tax=True)._check_tax_rule()
+ # order.with_context(skip_check_payment=True)._check_payment_term()
+ # order.with_context(notify_tax=True)._check_tax_rule()
return order
def write(self, vals):