[IMP] rename_fields: Be able to use a cursor instead of Environment#355
[IMP] rename_fields: Be able to use a cursor instead of Environment#355rousseldenis wants to merge 2 commits intoOCA:masterfrom
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 |
pedrobaeza
left a comment
There was a problem hiding this comment.
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.
|
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.