summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-07-26 14:50:44 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-07-26 14:50:44 +0700
commit9eb74d5978a1d18c3374dbc0b4358bd189cfc8e9 (patch)
tree01b2cd8f24e3d1076db7dc4e1e266504d13deb8b
parente09e59db22d65fa144c2a43cd8f6959fada49484 (diff)
(andri) add validasi input tanggal kembali
-rw-r--r--indoteknik_custom/models/down_payment.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/indoteknik_custom/models/down_payment.py b/indoteknik_custom/models/down_payment.py
index 0429c4d8..04dfbbc4 100644
--- a/indoteknik_custom/models/down_payment.py
+++ b/indoteknik_custom/models/down_payment.py
@@ -1,5 +1,5 @@
from odoo import models, api, fields, _
-from odoo.exceptions import UserError
+from odoo.exceptions import UserError, ValidationError
from datetime import date, datetime, timedelta
# import datetime
import logging
@@ -361,6 +361,16 @@ class DownPayment(models.Model):
rec.estimated_return_date = False
rec.days_remaining = 0
+ @api.onchange('date_back_to_office')
+ def _onchange_date_back_to_office(self):
+ if self.date_back_to_office and self.date_back_to_office < date.today():
+ return {
+ 'warning': {
+ 'title': _('Tanggal Tidak Valid'),
+ 'message': _('Tanggal kembali ke kantor tidak boleh lebih awal dari hari ini.')
+ }
+ }
+
@api.onchange('applicant_name')
def _onchange_applicant_name(self):
if self.applicant_name: