summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-03-26 13:48:25 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-03-26 13:48:25 +0700
commitcefc6ec6de52f2c79c1760cf88db3375f4956a31 (patch)
tree7c7ea32380605b4aab110b355a265b462cba9072 /indoteknik_custom/models
parent44220214132f20202da9f225ed46ecfe14057e2c (diff)
PUSH
Diffstat (limited to 'indoteknik_custom/models')
-rwxr-xr-xindoteknik_custom/models/sale_order.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index f66da470..3b3aef6a 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -234,7 +234,7 @@ class SaleOrder(models.Model):
nomor_so_pengganti = fields.Char(string='Nomor SO Pengganti', copy=False, tracking=3)
shipping_option_id = fields.Many2one("shipping.option", string="Selected Shipping Option", domain="['|', ('sale_order_id', '=', False), ('sale_order_id', '=', id)]")
- @api.constrains('write_date')
+ @api.constrains('fee_third_party', 'delivery_amt', 'biaya_lain_lain')
def _check_total_margin_excl_third_party(self):
for rec in self:
if rec.fee_third_party == 0:
@@ -1662,6 +1662,7 @@ class SaleOrder(models.Model):
# Ensure partner details are updated when a sale order is created
order = super(SaleOrder, self).create(vals)
order._compute_etrts_date()
+ order._check_total_margin_excl_third_party()
# order._update_partner_details()
return order
@@ -1704,5 +1705,6 @@ class SaleOrder(models.Model):
"SO tidak dapat ditambahkan produk baru karena SO sudah menjadi sale order.")
res = super(SaleOrder, self).write(vals)
if 'order_line' in vals:
+ self._check_total_margin_excl_third_party()
self._compute_etrts_date()
return res \ No newline at end of file