Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] project_timesheet_time_control: Condition always gets evaluated as False #321

Merged
merged 3 commits into from
Sep 28, 2017

Conversation

fuentes73
Copy link
Member

Hello,

We've notice that if a new analytic line is created with a date_time different from today. The field date is never equals to field date_time, because date has a default value defined at analytic module. So the condition in eval_date function is always evaluated as False

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change module version number

@@ -32,7 +32,7 @@ def onchange_task_id(self):
self.project_id = self.task_id.project_id.id

def eval_date(self, vals):
if 'date_time' in vals and 'date' not in vals:
if vals.get('date_time', False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change it then to if 'date_time' in vals and vals.get('date_time'):

@fuentes73
Copy link
Member Author

Done

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luismontalba @cubells please review

Copy link
Member

@luismontalba luismontalba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on runbot

Copy link
Contributor

@carlosdauden carlosdauden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments

@@ -32,7 +32,7 @@ def onchange_task_id(self):
self.project_id = self.task_id.project_id.id

def eval_date(self, vals):
if 'date_time' in vals and 'date' not in vals:
if 'date_time' in vals and vals.get('date_time'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that get is not needed in this case.
if 'date_time' in vals and vals['date_time']:

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually removing the first part and leaving the get would be functionally equivalent and cleaner:

if vals.get('date_time'):

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I wanted to avoid the None case, but you're right. It was correct the first time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'm going to change it as @lasley says.

@pedrobaeza pedrobaeza merged commit b2a9db4 into OCA:10.0 Sep 28, 2017
@fuentes73 fuentes73 deleted the 10-fix-project_timesheet_time_control branch September 28, 2017 07:56
ernestotejeda pushed a commit to ernestotejeda/project that referenced this pull request Jun 25, 2018
ernestotejeda pushed a commit to ernestotejeda/project that referenced this pull request Jun 26, 2018
pedrobaeza pushed a commit to ernestotejeda/project that referenced this pull request Aug 8, 2018
ernestotejeda pushed a commit to Tecnativa/project that referenced this pull request Nov 12, 2018
ernestotejeda pushed a commit to Tecnativa/project that referenced this pull request Jan 14, 2019
alexey-pelykh pushed a commit to brainbeanapps/project that referenced this pull request Feb 12, 2019
fuentes73 added a commit to Studio73/project that referenced this pull request Apr 27, 2019
alexey-pelykh pushed a commit to brainbeanapps/project that referenced this pull request Jun 5, 2019
ernestotejeda pushed a commit to Tecnativa/project that referenced this pull request Aug 27, 2019
manuelcalerosolis pushed a commit to Tecnativa/project that referenced this pull request Feb 26, 2020
pedrobaeza pushed a commit to Tecnativa/project that referenced this pull request Jul 7, 2020
watthanun pushed a commit to ecosoft-odoo/project that referenced this pull request Dec 23, 2020
manuelcalerosolis pushed a commit to xtendoo-corporation/project that referenced this pull request Jun 28, 2022
vincent-hatakeyama pushed a commit to xcgd/project that referenced this pull request Sep 28, 2022
CarlosRoca13 pushed a commit to Tecnativa/project that referenced this pull request Oct 5, 2022
CarlosRoca13 pushed a commit to Tecnativa/project that referenced this pull request Nov 7, 2022
daramousk pushed a commit to daramousk/project that referenced this pull request May 26, 2023
heliaktiv pushed a commit to heliaktiv/project that referenced this pull request Jun 6, 2023
stefan-tecnativa pushed a commit to Tecnativa/project that referenced this pull request Jul 6, 2023
pedrobaeza pushed a commit to Tecnativa/project that referenced this pull request Aug 1, 2023
Ricardoalso pushed a commit to camptocamp/project that referenced this pull request Oct 6, 2023
Ricardoalso pushed a commit to camptocamp/project that referenced this pull request Oct 6, 2023
chandni-serpentcs pushed a commit to chandni-serpentcs/project that referenced this pull request Jan 9, 2024
mde-scopea pushed a commit to mde-scopea/project that referenced this pull request Jan 31, 2024
RogerSans pushed a commit to sygel-technology/project that referenced this pull request Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants