summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMqdd <ahmadmiqdad27@gmail.com>2026-01-02 10:16:15 +0700
committerMqdd <ahmadmiqdad27@gmail.com>2026-01-02 10:16:15 +0700
commit20a17a725aa9f3ff3d94c9405042f924101a3d13 (patch)
tree98e08c846b4d529537e95693f8477e6fd986ede7
parent7c18662262af2041f18e0dd7890f88e72f066032 (diff)
<MIqdad> fix formula amount all PO
-rw-r--r--fixco_custom/models/purchase_order.py5
-rw-r--r--fixco_custom/views/purchase_order.xml1
2 files changed, 4 insertions, 2 deletions
diff --git a/fixco_custom/models/purchase_order.py b/fixco_custom/models/purchase_order.py
index cf8945e..f2a6c3e 100644
--- a/fixco_custom/models/purchase_order.py
+++ b/fixco_custom/models/purchase_order.py
@@ -55,6 +55,7 @@ class PurchaseOrder(models.Model):
soo_price = fields.Float('SOO Price', copy=False)
soo_discount = fields.Float('SOO Discount', copy=False)
soo_tax = fields.Float('SOO Tax', copy=False)
+ discount_total = fields.Float('Discount Total', help = 'Total Discount for Each Product')
def _get_fixco_token(self, source='auto'):
ICP = self.env['ir.config_parameter'].sudo()
@@ -422,12 +423,12 @@ class PurchaseOrder(models.Model):
'domain': [('id', 'in', journals.ids)],
}
- @api.depends('order_line.price_total', 'biaya_lain_lain')
+ @api.depends('order_line.price_total', 'biaya_lain_lain', 'discount_total')
def _amount_all(self):
super(PurchaseOrder, self)._amount_all()
for order in self:
- amount_total = order.amount_untaxed + order.amount_tax - order.biaya_lain_lain
+ amount_total = order.amount_untaxed + order.amount_tax + order.biaya_lain_lain - order.discount_total
order.amount_total = order.currency_id.round(amount_total)
@api.depends('order_line.discount_amount')
diff --git a/fixco_custom/views/purchase_order.xml b/fixco_custom/views/purchase_order.xml
index b68da31..d5e612c 100644
--- a/fixco_custom/views/purchase_order.xml
+++ b/fixco_custom/views/purchase_order.xml
@@ -40,6 +40,7 @@
<field name="soo_tax" readonly="1"/>
<field name="sale_order_id" readonly="1"/>
<field name="biaya_lain_lain"/>
+ <field name="discount_total"/>
<field name="shipping_cost"/>
<field name="source" readonly="1"/>
<field name="move_entry_id" readonly="1"/>