summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/dunning_run.py
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models/dunning_run.py')
-rw-r--r--indoteknik_custom/models/dunning_run.py14
1 files changed, 12 insertions, 2 deletions
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