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

[16.0][ADD] hr_timesheet_begin_end_no_end #691

Draft
wants to merge 6 commits into
base: 16.0
Choose a base branch
from

Conversation

carmenbianca
Copy link
Member

@carmenbianca carmenbianca commented Jun 17, 2024

Refactored some code in hr_timesheet_begin_end to be more extensible, and to be more Odoo 16-ish.

Then built a module that removes one of the constraints because of a customer request.

Depends on #692. This is based on top of that branch.

Internal task: T12630

@carmenbianca carmenbianca force-pushed the 16.0-no-end-time branch 3 times, most recently from 357dc26 to 6cb8367 Compare June 17, 2024 15:40
@carmenbianca carmenbianca marked this pull request as draft June 17, 2024 15:46
@carmenbianca carmenbianca marked this pull request as ready for review June 17, 2024 16:02
@carmenbianca
Copy link
Member Author

@huguesdk do you want to review this?

Copy link
Member

@huguesdk huguesdk left a comment

Choose a reason for hiding this comment

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

great refactor, thanks @carmenbianca!

please move the commits adding the new module to another pull request (commits on a branch on top of this one), as the refactor should be able to be accepted independently (and the version numbers correctly increased independently too).

@carmenbianca carmenbianca marked this pull request as draft June 20, 2024 09:47
@carmenbianca carmenbianca changed the title [16.0][REF/ADD] hr_timesheet_begin_end[_no_end] [16.0][ADD] hr_timesheet_begin_end_no_end Jun 20, 2024
Copy link
Member

@huguesdk huguesdk left a comment

Choose a reason for hiding this comment

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

just one small change request, otherwise lgtm (only the new module part, the rest is reviewed in #692).

are you planning to rebase this on the #692 branch?

Timesheet lines are characterised by having a project.

Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
The separation of checks into separate methods is needed because I want
to disable one check in another module. This makes the module more
extensible.

The unit_amount_from_start_stop method also makes the module more
extensible.

I have also moved the onchange to the top of the file, according to the
OCA contribution guidelines.

Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
Instead of using onchange, which is less convenient in Odoo 16.

Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
This is a tricky one. _Technically_ there is nothing that makes
hr_timesheet_begin_end incompatible with the other modules here.
However, when the project_id on a timesheet line is changed, unit_amount
is rerecomputed. This has some consequences.

In the sale_timesheet tests, the project_id of a timesheet line
is (sometimes?) recomputed. Subsequently, unit_amount is recomputed and
set to 0 when it _shouldn't_ be. Under a normal flow this wouldn't be a
problem; time_start and time_stop would be populated to correctly
recompute unit_amount. But in the tests, they are not.

One solution is to, in addition to not recomputing the unit_amount of
non-timesheet lines, not recompute the unit_amount of timesheet lines
whose time_start and time_stop are both set to 00:00. However, this
means that resetting these values to 00:00 does not correctly set
unit_amount back to 0, which seems erroneous to me.

Marking this module as a rebel module seems like the best course of
action to me, even though it would be preferable to test this in
conjunction with the other modules.

Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
Copy link
Member

@huguesdk huguesdk left a comment

Choose a reason for hiding this comment

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

just a cosmetic remark, otherwise lgtm! very clean solution!

hr_timesheet_begin_end_no_end/__manifest__.py Outdated Show resolved Hide resolved
Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
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.

2 participants