diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-08-27 13:39:59 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-08-27 13:39:59 +0700 |
| commit | 2103a438acc24ad44965b869a28a15424838c9b5 (patch) | |
| tree | cb1abcf54b9f7cd419c936b495354f0232984c3b | |
| parent | cdeceb0e5325b00a1239470ab3493d84edd8328d (diff) | |
(andri) 1. add sum open amount & add field amount total SO pada DE, 2. sum total amount pada dunning run
| -rw-r--r-- | indoteknik_custom/models/account_move_due_extension.py | 15 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_move_views.xml | 3 | ||||
| -rw-r--r-- | indoteknik_custom/views/dunning_run.xml | 2 |
3 files changed, 18 insertions, 2 deletions
diff --git a/indoteknik_custom/models/account_move_due_extension.py b/indoteknik_custom/models/account_move_due_extension.py index d354e3e3..40059bd9 100644 --- a/indoteknik_custom/models/account_move_due_extension.py +++ b/indoteknik_custom/models/account_move_due_extension.py @@ -14,6 +14,16 @@ class DueExtension(models.Model): number = fields.Char(string='Document No', index=True, copy=False, readonly=True, tracking=True) partner_id = fields.Many2one('res.partner', string="Customer", readonly=True) order_id = fields.Many2one('sale.order', string="SO", readonly=True) + amount_total = fields.Monetary( + string="Amount Total SO", + compute="_compute_amount_total", + readonly=True + ) + currency_id = fields.Many2one( + 'res.currency', + related="order_id.currency_id", + readonly=True + ) invoice_id = fields.Many2one('account.move', related='due_line.invoice_id', string='Invoice', readonly=False) due_line = fields.One2many('due.extension.line', 'due_id', string='Due Extension Lines', auto_join=True) old_due = fields.Date(string="Old Due") @@ -34,6 +44,11 @@ class DueExtension(models.Model): approve_by = fields.Many2one('res.users', string="Approve By", readonly=True) date_approve = fields.Datetime(string="Date Approve", readonly=True) + @api.depends('order_id') + def _compute_amount_total(self): + for rec in self: + rec.amount_total = rec.order_id.amount_total if rec.order_id else 0.0 + def _compute_counter(self): for due in self: due.counter = due.partner_id.counter diff --git a/indoteknik_custom/views/account_move_views.xml b/indoteknik_custom/views/account_move_views.xml index 0fd7c9cd..7c1f8913 100644 --- a/indoteknik_custom/views/account_move_views.xml +++ b/indoteknik_custom/views/account_move_views.xml @@ -33,7 +33,7 @@ <field name="efaktur_id"/> <field name="reference"/> <field name="total_amt"/> - <field name="open_amt"/> + <field name="open_amt" sum="Grand Total Open Amount"/> </tree> </field> </record> @@ -68,6 +68,7 @@ <field name="partner_id" readonly="1"/> <field name="day_extension" attrs="{'readonly': [('is_approve', '=', True)]}"/> <field name="order_id" readonly="1"/> + <field name="amount_total" readonly="1"/> </group> <group> <field name="is_approve" readonly="1"/> diff --git a/indoteknik_custom/views/dunning_run.xml b/indoteknik_custom/views/dunning_run.xml index 2117a7bb..210f7917 100644 --- a/indoteknik_custom/views/dunning_run.xml +++ b/indoteknik_custom/views/dunning_run.xml @@ -29,7 +29,7 @@ <field name="date_invoice"/> <field name="efaktur_id"/> <field name="reference"/> - <field name="total_amt"/> + <field name="total_amt" sum="Grand Total Amount"/> <field name="open_amt"/> <field name="due_date"/> </tree> |
