-
-
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
[FIX] load_data: update to version 17.0 #369
Conversation
Thanks for this change. I'm wondering if we should instead convert the first argument to What do you think, @StefanRijnhart @legalsylvain @hbrunn ? |
I dont get it. |
On v16-, you call the method |
OK ! You propose to replace
by
Adding a comment to say that an cr is required until 16 and an env is required since 17, right ? Personnaly, I prefer to keep the same signature Then, add :
then simply replace But both works, so it's maybe a matter of taste. I think that it can maybe generate more errors to change the type of the argument, depending of the version of the module that call the function. |
b9a2bf2
to
e1f7f8d
Compare
@legalsylvain Thank you for your solution. I find it very interesting and low risk. I have fixed it according to your solution. |
Why I was talking to pass |
e1f7f8d
to
84f8398
Compare
@pedrobaeza I have updated it according to your suggestion, please review it |
@@ -329,21 +337,21 @@ def load_data(cr, module_name, filename, idref=None, mode="init"): | |||
if ext == ".csv": | |||
noupdate = True | |||
tools.convert_csv_import( | |||
cr, module_name, pathname, fp.read(), idref, mode, noupdate | |||
env_or_cr, module_name, pathname, fp.read(), idref, mode, noupdate | |||
) | |||
elif ext == ".yml": | |||
yaml_import(cr, module_name, fp, None, idref=idref, mode=mode) |
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.
This one hasn't been changed, isn't 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.
Has been changed at 5bf1207c8cb7575fba4501aff4932c2cc952bf9f
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.
yaml_import
was removed from Odoo after 11 anyway.
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.
I know, but right now, the code will fail in 11-, as cr
has no value for that case. Assign previously cr = env_or_cr
, or directly put here env_or_cr
.
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.
you are right, I added more at line 310
84f8398
to
8b3a4dd
Compare
changed on 17.0 (odoo/odoo@5bf1207)
8b3a4dd
to
2efc5b8
Compare
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.
Thanks for the patience attending our comments.
changed on 17.0
(odoo/odoo@5bf1207)