summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-07-09 11:15:10 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-07-09 11:15:10 +0700
commit0604dbc3a2789c139ea66dd561726f796ad92cd6 (patch)
tree65590a02278f442a3d095dee67e243f4d170320a
parent3537b1a2c0cea81db9c8d09656fa638745579752 (diff)
add grand total on approval payment term
-rw-r--r--indoteknik_custom/models/approval_payment_term.py7
-rw-r--r--indoteknik_custom/views/approval_payment_term.xml2
2 files changed, 9 insertions, 0 deletions
diff --git a/indoteknik_custom/models/approval_payment_term.py b/indoteknik_custom/models/approval_payment_term.py
index 00d990de..6e1c8103 100644
--- a/indoteknik_custom/models/approval_payment_term.py
+++ b/indoteknik_custom/models/approval_payment_term.py
@@ -44,6 +44,13 @@ class ApprovalPaymentTerm(models.Model):
string='Sale Order Totals',
compute='_compute_total'
)
+
+ grand_total = fields.Float(string='Grand Total', compute="_compute_grand_total")
+
+ def _compute_grand_total(self):
+ for rec in self:
+ grand_total = sum(order.amount_total for order in rec.sale_order_ids)
+ rec.grand_total = grand_total
def _compute_total(self):
for rec in self:
diff --git a/indoteknik_custom/views/approval_payment_term.xml b/indoteknik_custom/views/approval_payment_term.xml
index ca3ce02d..e785b72a 100644
--- a/indoteknik_custom/views/approval_payment_term.xml
+++ b/indoteknik_custom/views/approval_payment_term.xml
@@ -17,6 +17,7 @@
<field name="create_uid" optional="hide"/>
<field name="sale_order_ids" optional="hide" widget="many2many_tags"/>
<field name="total" optional="hide"/>
+ <field name="grand_total" optional="hide"/>
<field name="state" widget="badge" decoration-danger="state == 'rejected'"
decoration-success="state == 'approved'"
decoration-info="state == 'waiting_approval'"/>
@@ -64,6 +65,7 @@
<field name="approve_leader" readonly="1"/>
<field name="sale_order_ids" widget="many2many_tags"/>
<field name="total"/>
+ <field name="grand_total"/>
</group>
</group>
</sheet>