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

[11.0][IMP] hr_timesheet_sheet: ease extensions #131

Merged
merged 2 commits into from
Sep 11, 2018
Merged

[11.0][IMP] hr_timesheet_sheet: ease extensions #131

merged 2 commits into from
Sep 11, 2018

Conversation

astirpe
Copy link
Member

@astirpe astirpe commented Sep 11, 2018

Module hr_timesheet_sheet implements a constraint on the timesheet lines: they cannot be modified in case the timesheet sheet is approved. However in some our customizations, we need to relax a bit this constraint, allowing in some particular cases to write on a timesheet line, even when the timesheet sheet was already approved.

This is a proposal for letting the def _check_state() method be skipped.
Also an extra hook method is added, to let the customization modules decide whether def _check_state() should be executed or not.

This way the module will be easier to be extended.

@astirpe
Copy link
Member Author

astirpe commented Sep 11, 2018

@mreficent may I ask you to have a look at this PR ?

def _check_state(self):
if self._context.get('skip_check_state'):
Copy link
Member

Choose a reason for hiding this comment

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

Use self.env.context instead

Copy link
Member Author

Choose a reason for hiding this comment

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

Why is it preferable?

Copy link
Member

Choose a reason for hiding this comment

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

That variable is internal and might change, and Odoo itself deprecated it:

https://github.com/odoo/odoo/blob/5a1f874602ee649dfedf01c1be8f33d133677d00/odoo/models.py#L4354

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you!

@pedrobaeza pedrobaeza merged commit 961dd54 into OCA:11.0 Sep 11, 2018
@astirpe astirpe deleted the 11_imp_hr_timesheet_sheet branch September 11, 2018 14:20
alexey-pelykh pushed a commit to brainbeanapps/timesheet that referenced this pull request Nov 9, 2018
flachica pushed a commit to flachica/timesheet that referenced this pull request Mar 2, 2020
MiquelRForgeFlow pushed a commit to ForgeFlow/hr-timesheet that referenced this pull request Apr 6, 2020
MiquelRForgeFlow pushed a commit to ForgeFlow/hr-timesheet that referenced this pull request Apr 6, 2020
pniederlag pushed a commit to datenbetrieb/timesheet that referenced this pull request Dec 26, 2020
schhatbar-initos pushed a commit to initOS/timesheet that referenced this pull request Mar 9, 2021
yajo pushed a commit to moduon/timesheet that referenced this pull request Mar 30, 2022
dochse pushed a commit to dochse/timesheet that referenced this pull request Apr 21, 2022
dochse pushed a commit to dochse/timesheet that referenced this pull request Apr 22, 2022
benwillig pushed a commit to resultrum/timesheet that referenced this pull request Sep 1, 2022
bizzappdev pushed a commit to bizzappdev/timesheet that referenced this pull request Nov 5, 2022
bizzappdev pushed a commit to BizzAppDev-Systems/timesheet that referenced this pull request Feb 20, 2023
tarteo pushed a commit to tarteo/timesheet that referenced this pull request Feb 28, 2023
len-foss pushed a commit to len-foss/timesheet that referenced this pull request Jun 14, 2023
dreispt pushed a commit to ursais/timesheet that referenced this pull request Jan 21, 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.

None yet

4 participants