-
-
Notifications
You must be signed in to change notification settings - Fork 173
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
[IMP] rename_fields: Be able to use a cursor instead of Environment #355
base: master
Are you sure you want to change the base?
Conversation
In some cases, we want to use the rename_fields() method without using a full environment but with a cursor instead.
af6503b
to
4ff74cb
Compare
4ff74cb
to
86f48a5
Compare
This PR has the |
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.
deep=False
parameter is already for not doing stuff with ORM if not available, but you can get any environment even in base
pre-migration, or fake it with a class containing the property cr
.
@rousseldenis why do you want to do this?
IMO it's to complicate the number of methods without reason.
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.
By the stated above
Seeing @pedrobaeza comment, what do you think of doing this instead this? def rename_fields(env_or_cr, field_spec, no_deep=False):
if not no_deep:
env = env_or_cr
cr = env.cr
else:
cr = env_or_cr
(...code using cr here...)
if not no_deep:
(...code using env here...) maybe we could rename |
OK about the renaming. It has this name for also not doing all the stuff we have in #319 |
In some cases, we want to use the rename_fields() method without using a full environment but with a cursor instead.