Skip to content

[20.0][MIG] hr_timesheet_begin_end: Migration to 20.0 - #983

Open
weinni2000 wants to merge 14 commits into
OCA:20.0from
weinni2000:20.0-mig-hr_timesheet_begin_end
Open

weinni2000 wants to merge 14 commits into
OCA:20.0from
weinni2000:20.0-mig-hr_timesheet_begin_end

Conversation

@weinni2000

Copy link
Copy Markdown

Migrate hr_timesheet_begin_end to Odoo 20.0, preserving the module history with the OCA migration flow.

Replace the removed uom.uom.rounding access with uom.uom.compare() so duration validation continues to use Product Unit precision. Rename the view files per model and regenerate the README for 20.0.

Validation:

  • Fresh Odoo 20.0 installation passed.
  • Module tests passed on a separate fresh database (/hr_timesheet_begin_end).
  • All configured module pre-commit hooks passed, including pylint-odoo.

Upstream API change: odoo/odoo@9a4ad7c

CRogos and others added 7 commits October 31, 2026 21:11
[UPD] Update hr_timesheet_begin_end.pot

[UPD] README.rst

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: timesheet-16.0/timesheet-16.0-hr_timesheet_begin_end
Translate-URL: https://translation.odoo-community.org/projects/timesheet-16-0/timesheet-16-0-hr_timesheet_begin_end/

[UPD] README.rst
Translated using Weblate (Portuguese (Brazil))

Currently translated at 100.0% (6 of 6 strings)

Translation: timesheet-16.0/timesheet-16.0-hr_timesheet_begin_end
Translate-URL: https://translation.odoo-community.org/projects/timesheet-16-0/timesheet-16-0-hr_timesheet_begin_end/pt_BR/
Translated using Weblate (Catalan)

Currently translated at 100.0% (6 of 6 strings)

Translation: timesheet-16.0/timesheet-16.0-hr_timesheet_begin_end
Translate-URL: https://translation.odoo-community.org/projects/timesheet-16-0/timesheet-16-0-hr_timesheet_begin_end/ca/
@oca-cla-bot

oca-cla-bot Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@OCA-git-bot OCA-git-bot added mod:hr_timesheet_begin_end Module hr_timesheet_begin_end series:20.0 labels Oct 31, 2026
@weinni2000

Copy link
Copy Markdown
Author

Hi @bertstomphorst @NICO-SOLUTIONS, your earlier commits are part of this migration, and the CLA check fails for bert@advisto.nl and 74965194+NICO-SOLUTIONS@users.noreply.github.com. Could you sign at https://clabot.odoo-community.org/ (or have them added to your company's CLA)? Thanks!

@NICO-SOLUTIONS

Copy link
Copy Markdown
Member

Hi @bertstomphorst @NICO-SOLUTIONS, your earlier commits are part of this migration, and the CLA check fails for bert@advisto.nl and 74965194+NICO-SOLUTIONS@users.noreply.github.com. Could you sign at https://clabot.odoo-community.org/ (or have them added to your company's CLA)? Thanks!

@weinni2000 done

@weinni2000

Copy link
Copy Markdown
Author

@CRogos @NICO-SOLUTIONS:
could you by any chance review the PR and approve? here is the simple diff, there are only minor changes:
https://github.com/weinni2000/timesheet/pull/2/changes#diff-0a9c4bfbe4b2140c5feff28eb67d56e27b95b1f4b48bde282bbda2f369ef994b

@CRogos

CRogos commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Sorry I am not using this module anymore and can't stop advertising ;-) https://github.com/OCA/timesheet/tree/19.0/hr_timesheet_time_control_begin_end

PS: adminstrative commits are not squashed

@weinni2000
weinni2000 force-pushed the 20.0-mig-hr_timesheet_begin_end branch from 61567e4 to f0607c9 Compare November 2, 2026 14:49
@NICO-SOLUTIONS

Copy link
Copy Markdown
Member

Sorry I am not using this module anymore and can't stop advertising ;-) https://github.com/OCA/timesheet/tree/19.0/hr_timesheet_time_control_begin_end

PS: adminstrative commits are not squashed

@CRogos
@weinni2000

Same here. I’m also using the module that Crogos mentioned. I guess there are still quite a few people using it and who might want to stick with it, so we should continue supporting it here as well.

I’ll take a closer look when I find some time.

Besides that, Crogos is right when it comes to squashing.

@NICO-SOLUTIONS NICO-SOLUTIONS left a comment

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.

Functional and code review: LGTM.

Please also squash the left UPD commit according to the OCA merge/squash guidelines.

@rrebollo rrebollo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Installed this head into a fresh 20.0 database with sale_timesheet and ran the module's suite: it installs clean, the tests pass, and every view anchor resolves. The uom.uom.rounding replacement is faithful — compare() resolves to the same two-digit Product Unit precision the removed field exposed, and it is the idiom upstream's own commit uses. The migration is otherwise complete against the 20.0 guide: version bumped, no ACL to move to ir.access, no Font Awesome icons, TransactionCase so _test_user_groups does not apply. What remains is the added fields not following a mechanism 20.0 introduced in these very views, plus one naming nit. The view finding was confirmed in the web client on a reinvoiced line, not only in the arch. Please consider my concerns. Also would you be so kind to review some of my current open PRs #990 and #991 ?

Comment on lines +9 to +10
<field name="time_start" widget="float_time" optional="show" />
<field name="time_stop" widget="float_time" optional="show" />

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Every field the core timesheet list and form expose is gated by readonly="readonly_timesheet" — new in 20.0 (hr_timesheet/models/account_analytic_line.py:117), true for billed and time-off lines. These two are not, so Begin/End Hour stay editable while unit_amount, the value the constraint compares against, is locked. Reproduced in the web client on a reinvoiced line: date, name and unit_amount render read-only, Begin Hour is an input, and changing it raises "The duration (02:00) must be equal to the difference between the hours (03:00)", which the locked field cannot fix.

Suggested change
<field name="time_start" widget="float_time" optional="show" />
<field name="time_stop" widget="float_time" optional="show" />
<field name="time_start" widget="float_time" optional="show" readonly="readonly_timesheet" />
<field name="time_stop" widget="float_time" optional="show" readonly="readonly_timesheet" />

Comment on lines +22 to +23
<field name="time_start" widget="float_time" />
<field name="time_stop" widget="float_time" />

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
<field name="time_start" widget="float_time" />
<field name="time_stop" widget="float_time" />
<field name="time_start" widget="float_time" readonly="readonly_timesheet" />
<field name="time_stop" widget="float_time" readonly="readonly_timesheet" />

Comment on lines +14 to +15
<field name="time_start" widget="float_time" />
<field name="time_stop" widget="float_time" />

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
<field name="time_start" widget="float_time" />
<field name="time_stop" widget="float_time" />
<field name="time_start" widget="float_time" readonly="readonly_timesheet" />
<field name="time_stop" widget="float_time" readonly="readonly_timesheet" />

Comment on lines +21 to +22
<field name="time_start" widget="float_time" />
<field name="time_stop" widget="float_time" />

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
<field name="time_start" widget="float_time" />
<field name="time_stop" widget="float_time" />
<field name="time_start" widget="float_time" readonly="readonly_timesheet" />
<field name="time_stop" widget="float_time" readonly="readonly_timesheet" />

Comment on lines +35 to +36
hour_uom_id = self.env.ref("uom.product_uom_hour")
if hours and hour_uom_id.compare(hours, line.unit_amount):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

hour_uom_id holds a uom.uom recordset, not an id — the _id suffix is reserved for a record id and leaves the next reader expecting an int.

Suggested change
hour_uom_id = self.env.ref("uom.product_uom_hour")
if hours and hour_uom_id.compare(hours, line.unit_amount):
hour_uom = self.env.ref("uom.product_uom_hour")
if hours and hour_uom.compare(hours, line.unit_amount):

@weinni2000
weinni2000 requested a review from rrebollo November 8, 2026 13:50
BhaveshHeliconia and others added 5 commits November 8, 2026 15:26
The validation for overlapping times was done on user_id, which is the user entering the lines. This should be on employee_id, the employee *for who* the times are entered.
Odoo 20 removes uom.uom.rounding. Use the unit comparison API to keep
duration validation consistent with Product Unit precision.

Upstream:
odoo/odoo@9a4ad7c
@weinni2000
weinni2000 force-pushed the 20.0-mig-hr_timesheet_begin_end branch from f0607c9 to 804b7b8 Compare November 8, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:hr_timesheet_begin_end Module hr_timesheet_begin_end series:20.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants