diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-09-20 14:12:00 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-09-20 14:12:00 +0700 |
| commit | d2bb21ae878db2a3b77dbb3341046c9d12ba1de5 (patch) | |
| tree | ddea32e5e90fb1944205536365be12766d9f1101 | |
| parent | b34c5cc5d6cc3dc1e9ccf43cecc14a5a7a427992 (diff) | |
add grand total on dunning run and bill receipt
| -rw-r--r-- | indoteknik_custom/models/bill_receipt.py | 10 | ||||
| -rw-r--r-- | indoteknik_custom/models/dunning_run.py | 9 | ||||
| -rw-r--r-- | indoteknik_custom/views/bill_receipt.xml | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/dunning_run.xml | 2 |
4 files changed, 21 insertions, 2 deletions
diff --git a/indoteknik_custom/models/bill_receipt.py b/indoteknik_custom/models/bill_receipt.py index 76449c1f..7d38d5ad 100644 --- a/indoteknik_custom/models/bill_receipt.py +++ b/indoteknik_custom/models/bill_receipt.py @@ -22,8 +22,16 @@ class BillReceipt(models.Model): resi_tukar_faktur = fields.Char(string='Resi Faktur') date_terima_tukar_faktur = fields.Date(string='Terima Faktur') shipper_faktur_id = fields.Many2one('delivery.carrier', string='Shipper Faktur') - is_validated = fields.Boolean(string='Validated') + is_validated = fields.Boolean(string='Validated') notification = fields.Char(string='Notification') + 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.bill_line: + grand_total += line.total_amt + record.grand_total = grand_total def copy_date_faktur(self): if not self.is_validated: 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: diff --git a/indoteknik_custom/views/bill_receipt.xml b/indoteknik_custom/views/bill_receipt.xml index 15d82e7b..02b28ddf 100644 --- a/indoteknik_custom/views/bill_receipt.xml +++ b/indoteknik_custom/views/bill_receipt.xml @@ -13,6 +13,7 @@ <field name="resi_tukar_faktur"/> <field name="date_terima_tukar_faktur"/> <field name="shipper_faktur_id"/> + <field name="grand_total"/> </tree> </field> </record> @@ -69,6 +70,7 @@ <field name="resi_tukar_faktur"/> <field name="date_terima_tukar_faktur"/> <field name="shipper_faktur_id"/> + <field name="grand_total"/> </group> </group> <notebook> diff --git a/indoteknik_custom/views/dunning_run.xml b/indoteknik_custom/views/dunning_run.xml index dd5bb120..522be8c9 100644 --- a/indoteknik_custom/views/dunning_run.xml +++ b/indoteknik_custom/views/dunning_run.xml @@ -13,6 +13,7 @@ <field name="resi_tukar_faktur"/> <field name="date_terima_tukar_faktur"/> <field name="shipper_faktur_id"/> + <field name="grand_total"/> </tree> </field> </record> @@ -71,6 +72,7 @@ <field name="resi_tukar_faktur"/> <field name="date_terima_tukar_faktur"/> <field name="shipper_faktur_id"/> + <field name="grand_total"/> </group> </group> <notebook> |
