From e3c9d12ca2356493bb75c7362d0da54280889828 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 10 Sep 2025 12:22:07 +0700 Subject: dunning done --- indoteknik_custom/models/dunning_run.py | 2 ++ 1 file changed, 2 insertions(+) (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 5a6aebac..eb6f06dc 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -31,6 +31,7 @@ class DunningRun(models.Model): description = fields.Char(string='Description') comment = fields.Char(string='Comment') grand_total = fields.Float(string='Grand Total', compute="_compute_grand_total") + is_paid = fields.Boolean(string='Sudah Bayar?') def _compute_grand_total(self): for record in self: @@ -149,4 +150,5 @@ class DunningRunLine(models.Model): total_amt = fields.Float(string='Total Amount') open_amt = fields.Float(string='Open Amount') due_date = fields.Date(string='Due Date') + payment_term = fields.Many2one('account.payment.term', related='invoice_id.invoice_payment_term_id', string='Payment Term') -- cgit v1.2.3 From 4ce4b37fa551e1059cdb5f64f98c53d4289d3268 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 10 Sep 2025 16:04:39 +0700 Subject: dunning done --- indoteknik_custom/models/dunning_run.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (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 eb6f06dc..40e5f71e 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -1,6 +1,6 @@ from odoo import models, api, fields from odoo.exceptions import AccessError, UserError, ValidationError -from datetime import timedelta +from datetime import timedelta, date import logging @@ -32,7 +32,17 @@ class DunningRun(models.Model): comment = fields.Char(string='Comment') grand_total = fields.Float(string='Grand Total', compute="_compute_grand_total") is_paid = fields.Boolean(string='Sudah Bayar?') - + tanggal_pembayaran = fields.Date( + string='Tanggal Pembayaran', + compute="_compute_tanggal_pembayaran", + readonly=True, + ) + + @api.depends('is_paid') + def _compute_tanggal_pembayaran(self): + today = fields.Date.context_today(self) + for rec in self: + rec.tanggal_pembayaran = today if rec.is_paid else False def _compute_grand_total(self): for record in self: grand_total = 0 -- cgit v1.2.3 From 8aceb84b2cf029308903b39bfe139a05ea8f73f6 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 10 Sep 2025 16:08:34 +0700 Subject: dunning done --- indoteknik_custom/models/dunning_run.py | 1 + 1 file changed, 1 insertion(+) (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 40e5f71e..557eacef 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -43,6 +43,7 @@ class DunningRun(models.Model): today = fields.Date.context_today(self) for rec in self: rec.tanggal_pembayaran = today if rec.is_paid else False + def _compute_grand_total(self): for record in self: grand_total = 0 -- cgit v1.2.3 From e276a3bbf0a2726cbfa6bb5606d2dfbfe1e03143 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 10 Sep 2025 18:34:49 +0700 Subject: Remove tanggal bayar and is paid --- indoteknik_custom/models/dunning_run.py | 12 ------------ 1 file changed, 12 deletions(-) (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 557eacef..9feea1d1 100644 --- a/indoteknik_custom/models/dunning_run.py +++ b/indoteknik_custom/models/dunning_run.py @@ -31,18 +31,6 @@ class DunningRun(models.Model): description = fields.Char(string='Description') comment = fields.Char(string='Comment') grand_total = fields.Float(string='Grand Total', compute="_compute_grand_total") - is_paid = fields.Boolean(string='Sudah Bayar?') - tanggal_pembayaran = fields.Date( - string='Tanggal Pembayaran', - compute="_compute_tanggal_pembayaran", - readonly=True, - ) - - @api.depends('is_paid') - def _compute_tanggal_pembayaran(self): - today = fields.Date.context_today(self) - for rec in self: - rec.tanggal_pembayaran = today if rec.is_paid else False def _compute_grand_total(self): for record in self: -- cgit v1.2.3