Skip to content

[18.0][IMP] project_timesheet_time_control: Add search functionality for date_time_end and improve computation for end time based on day unit#1609

Merged
OCA-git-bot merged 1 commit intoOCA:18.0from
c4a8-odoo:18.0-project_timesheet_time_control-search
Feb 12, 2026
Merged

[18.0][IMP] project_timesheet_time_control: Add search functionality for date_time_end and improve computation for end time based on day unit#1609
OCA-git-bot merged 1 commit intoOCA:18.0from
c4a8-odoo:18.0-project_timesheet_time_control-search

Conversation

@CRogos
Copy link
Copy Markdown
Contributor

@CRogos CRogos commented Nov 19, 2025

When you use hr_timesheet_calendar, the calendar control searches for date_time_end. Therefore there are a lot of errors in the log.

 2025-11-19 19:21:33,393 4 ERROR db_name odoo.osv.expression: Non-stored field account.analytic.line.date_time_end cannot be searched. 
NoneType: None

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @victoralmau,
some modules you are maintaining are being modified, check this out!

@CRogos CRogos changed the title [IMP] project_timesheet_time_control: Add search functionality for date_time_end and improve computation for end time based on day unit [18.0][IMP] project_timesheet_time_control: Add search functionality for date_time_end and improve computation for end time based on day unit Nov 19, 2025
@CRogos
Copy link
Copy Markdown
Contributor Author

CRogos commented Nov 19, 2025

@lbarry-apsl could you also have a look at this. I think you have the same issue. Thank you.

Copy link
Copy Markdown

@MohamedOsman7 MohamedOsman7 left a comment

Choose a reason for hiding this comment

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

Code review LGTM

@CRogos
Copy link
Copy Markdown
Contributor Author

CRogos commented Jan 16, 2026

@victoralmau could you please review?

@pedrobaeza pedrobaeza added this to the 18.0 milestone Feb 12, 2026
Copy link
Copy Markdown
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.

Is SQL totally needed in this case?

def _search_date_time_end(self, operator, value):
# reference value is 1 day == 8 hours
hour_uom = self.env.ref("uom.product_uom_hour")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please don't add empty lines inside methods (being also consistent with existing code).

@CRogos
Copy link
Copy Markdown
Contributor Author

CRogos commented Feb 12, 2026

@pedrobaeza do you have another suggestion regarding the SQL?

The date_time_end depends on date_time + (duration * unit_factor). I did not find a solution to query this without SQL.
Another solution would be to make date_time_end stored, but than we need to make sure that start/end/duration is always correct.

@CRogos CRogos force-pushed the 18.0-project_timesheet_time_control-search branch from bd82f59 to ce8c816 Compare February 12, 2026 16:57
Copy link
Copy Markdown
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.

OK, let's go with the SQL. The alternative is to make a search with the desired elements, and then pass a domain ("id", "in", ...), but it can be less performant.

}
)
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here you still have empty lines inside methods.

…te_time_end and improve computation for end time based on day unit
@CRogos CRogos force-pushed the 18.0-project_timesheet_time_control-search branch from ce8c816 to ac71461 Compare February 12, 2026 17:10
Copy link
Copy Markdown
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.

Thanks for attending my nitpickings :)

/ocabot merge patch

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 18.0-ocabot-merge-pr-1609-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit c30670c into OCA:18.0 Feb 12, 2026
5 of 7 checks passed
@OCA-git-bot
Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 56fbb1e. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants