-
-
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: switch to binary mode for recent versions #394
Conversation
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, as of version 11.0 Odoo uses BytesIO not StringIO and opens the file with mode rb
not b
(https://github.com/odoo/odoo/blob/11.0/odoo/tools/convert.py#L784). It is not the same in earlier versions. Can you make this behaviour version dependent, and please fix the pre-commit.
Oh, and please change commit message to include the method name (rather like the module name in other repos), e.g. |
Is this affecting XML files loading? |
As far as I can tell, Odoo loads all file types with mode |
@StefanRijnhart Best Regards |
OK, then rename the commit as stated by Stefan. |
Hi @StefanRijnhart / @pedrobaeza , thank you for your review. The commit message is already updated. |
Please check pre-commit. |
@jue-adhoc Please also make the change version specific. This code needs to remain compatible with older versions of Odoo, so only apply the change when the version is 11 or higher. |
@StefanRijnhart sorry, I misunderstood your previous review on this point. I already made the changes to make the fix compatible with versions older than 11. Thank you! |
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 update!
We found the following error when trying to upload csv files via the load_data method:
This is because it is expecting a binary file and it is receiving a str.