From d2bb21ae878db2a3b77dbb3341046c9d12ba1de5 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 20 Sep 2024 14:12:00 +0700 Subject: add grand total on dunning run and bill receipt --- indoteknik_custom/models/dunning_run.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models/dunning_run.py') diff --git a/indoteknik_custom/models/dunning_run.py b/indoteknik_custom/models/dunning_run.py index 90159cd0..c167aab7 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -30,7 +30,14 @@ class DunningRun(models.Model): is_paid = fields.Boolean(string='Paid') description = fields.Char(string='Description') comment = fields.Char(string='Comment') - + grand_total = fields.Float(string='Grand Total', compute="_compute_grand_total") + + def _compute_grand_total(self): + for record in self: + grand_total = 0 + for line in record.dunning_line: + grand_total += line.total_amt + record.grand_total = grand_total def copy_date_faktur(self): if not self.is_validated: -- cgit v1.2.3