From 1ff7de11ff01e2e9d2a48760253feff3d4907c07 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Thu, 18 Feb 2021 13:13:42 +0530 Subject: [PATCH] update changes for float field --- cor_custom/models/analytic.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cor_custom/models/analytic.py b/cor_custom/models/analytic.py index 3df681a..1dd460b 100755 --- a/cor_custom/models/analytic.py +++ b/cor_custom/models/analytic.py @@ -104,13 +104,17 @@ class AccountAnalyticLine(models.Model): if rec.end_time < rec.start_time: raise exceptions.ValidationError(_('End time cannot be earlier than Start time')) - @api.onchange('start_time', 'end_time') + @api.onchange('start_time', 'end_time', 'start_datetime', 'end_datetime') def _onchange_start_end_time(self): if self.start_time > 0 and self.end_time > 0: res = self.end_time - self.start_time if res <= 0: raise ValidationError(_("End time cannot be earlier than Start time")) self.unit_amount = res + # if self.start_datetime and self.end_datetime: + # res1 = self.end_datetime - self.start_datetime + # print('ressssssssss', res1) + # self.unit_amount = res1 @api.model def export_data(self, fields):