-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
[ADD] invalid-commit: Add new check invalid-commit #28
[ADD] invalid-commit: Add new check invalid-commit #28
Conversation
moylop260
commented
May 17, 2016
•
edited
edited
- Verify the guideline never-commit-the-transaction
1d344fe
to
1b71bca
Compare
1b71bca
to
4d4831c
Compare
👍 |
1 similar comment
👍 |
Commit could still be valid such as in cron tasks or for performance reasons.
|
@guewen with openerp.api.Environment.manage():
with openerp.registry(self.env.cr.dbname).cursor() as new_cr:
# Create a new environment with new cursor database
new_env = api.Environment(new_cr, self.env.uid, self.env.context)
# with_env replace original env for this method
self.with_env(new_env).write({'name': 'hello'}) # isolated transaction to commit
new_env.cr.commit() # Don't show a invalid-commit in this case
# You don't need close your cr because is closed when finish "with"
# You don't need clear caches because is cleared when finish "with" Third step: Then use |
ok noted, thanks |
👍 |
Somebody, could be merged it? |