summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindoteknik_custom/models/sale_order.py4
-rwxr-xr-xindoteknik_custom/views/sale_order.xml2
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 @@
<field name="fee_third_party"/>
<field name="biaya_lain_lain"/>
<field name="total_percent_margin"/>
- <field name="total_margin_excl_third_party"/>
+ <field name="total_margin_excl_third_party" readonly="1"/>
<field name="type_promotion"/>
<label for="voucher_id"/>
<div class="o_row">