From cefc6ec6de52f2c79c1760cf88db3375f4956a31 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 26 Mar 2025 13:48:25 +0700 Subject: PUSH --- indoteknik_custom/models/sale_order.py | 4 +++- indoteknik_custom/views/sale_order.xml | 2 +- 2 files changed, 4 insertions(+), 2 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 diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index db89d121..74730e06 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -33,7 +33,7 @@ - +