summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-09-10 16:04:39 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-09-10 16:04:39 +0700
commit4ce4b37fa551e1059cdb5f64f98c53d4289d3268 (patch)
treeee854536d13acc3c0da40b6bee48cb1201490310
parente3c9d12ca2356493bb75c7362d0da54280889828 (diff)
<miqdad> dunning done
-rw-r--r--indoteknik_custom/models/approval_payment_term.py3
-rw-r--r--indoteknik_custom/models/dunning_run.py14
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