From b8067ee79830fed439a88623ea50a7c706a85acd Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Wed, 17 Feb 2021 23:23:36 +0530 Subject: [PATCH] add date from datetime --- cor_custom/models/analytic.py | 6 ++++++ cor_custom/views/analytic_view.xml | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cor_custom/models/analytic.py b/cor_custom/models/analytic.py index 842c88c..3df681a 100755 --- a/cor_custom/models/analytic.py +++ b/cor_custom/models/analytic.py @@ -8,6 +8,7 @@ import math from datetime import datetime, time, timedelta from odoo.tools.float_utils import float_round from odoo.tools import DEFAULT_SERVER_DATE_FORMAT, ustr +import dateutil.parser class AccountAnalyticLine(models.Model): @@ -161,3 +162,8 @@ class AccountAnalyticLine(models.Model): if self.project_id: self.project_id._onchange_calculate_timesheet_hours() return res + + @api.onchange('start_datetime', 'end_datetime') + def _onchange_start_end_date(self): + if self.start_datetime: + self.date = self.start_datetime.date() diff --git a/cor_custom/views/analytic_view.xml b/cor_custom/views/analytic_view.xml index 5ecd809..a867918 100755 --- a/cor_custom/views/analytic_view.xml +++ b/cor_custom/views/analytic_view.xml @@ -64,8 +64,8 @@ account.analytic.line.tree.hr_timesheet account.analytic.line - - + + @@ -75,8 +75,8 @@ - - + + @@ -161,20 +161,20 @@ - + - - + +