-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
Conversation
@mreficent may I ask you to have a look at this PR ? |
def _check_state(self): | ||
if self._context.get('skip_check_state'): |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it preferable?
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
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.