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 /indoteknik_custom/models | |
| parent | cdeceb0e5325b00a1239470ab3493d84edd8328d (diff) | |
(andri) 1. add sum open amount & add field amount total SO pada DE, 2. sum total amount pada dunning run
Diffstat (limited to 'indoteknik_custom/models')
| -rw-r--r-- | indoteknik_custom/models/account_move_due_extension.py | 15 |
1 files changed, 15 insertions, 0 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 |
