diff options
| -rw-r--r-- | indoteknik_custom/models/approval_payment_term.py | 3 | ||||
| -rw-r--r-- | indoteknik_custom/models/dunning_run.py | 14 |
2 files changed, 14 insertions, 3 deletions
diff --git a/indoteknik_custom/models/approval_payment_term.py b/indoteknik_custom/models/approval_payment_term.py index 85fd1613..61339b99 100644 --- a/indoteknik_custom/models/approval_payment_term.py +++ b/indoteknik_custom/models/approval_payment_term.py @@ -106,7 +106,8 @@ class ApprovalPaymentTerm(models.Model): if changes: timestamp = fields.Datetime.now().strftime('%Y-%m-%d %H:%M:%S') - rec.change_log_688 = f"{timestamp} - Perubahan oleh Widya:\n" + "\n".join(changes) + user = self.env.user + rec.change_log_688 = f"{timestamp} - Perubahan oleh {user.name}:\n" + "\n".join(changes) @staticmethod 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 |
