diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-08-28 07:57:50 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-08-28 07:57:50 +0700 |
| commit | 1ddc20d9d2b72ca68eecd07c9a3d78a008842cc0 (patch) | |
| tree | c0825c1e15144d584f14f008209350b9d8287b34 | |
| parent | 3286de7f2d48f913ad1aa477b49155047ebb742c (diff) | |
| parent | e8c10203b9cac4e8fe020a56f39945fbd360b605 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into regenerate_midtrans_web
| -rw-r--r-- | indoteknik_custom/models/account_move_due_extension.py | 15 | ||||
| -rw-r--r-- | indoteknik_custom/models/res_partner.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_move_views.xml | 3 | ||||
| -rw-r--r-- | indoteknik_custom/views/dunning_run.xml | 2 |
4 files changed, 19 insertions, 3 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/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 1dba200a..148a3fd0 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -283,7 +283,7 @@ class ResPartner(models.Model): ('email', '=', record.email) ], limit=1) - if existing_partner: + if existing_partner and not record.parent_id: raise ValidationError(f"Nama '{record.name}' dengan email '{record.email}' sudah digunakan oleh partner lain!") @api.constrains('npwp') 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> |
