[18.0][MIG] excel_import_export: Migration to 18.0
- remove useless
view_initin commit: https://github.com/odoo/odoo/pull/79563/commits/fbfbf1756b - fix domain (issue) on
template_idfield of import/export wizard. for some reasoncontextis no longer present in python dynamic domains, see example here: https://github.com/odoo/odoo/pull/135145/commits/6828dd3489 - user service is no longer a service, see: https://github.com/odoo/odoo/pull/145362/commits/ae660431
Testing locally and here are some things I have noticed:
It looks like the export function works, though the files are created without the option to set a file name. Instead the files are named based on their file size. The more problematic issue is that the files are named without their extensions:
When opened the files seem to be correct but they cannot be used for imports:
Error on trying to import file:
Manually adding .xlsx does not fix the import error
hi @wlin-kencove, fixed the above errors.
The export looks good now, though the import is still displaying errors for me:
I am using the file exported without editing it. I have it attached if it helps: S00001.xlsx
hi @wlin-kencove, i found out where the problem is. the error is in the xlrd library in the new version (which is no longer available with .xlsx file type), see: https://github.com/python-excel/xlrd/blob/0c4e80b3d48dfe2250ac4e514c8231a742fee221/xlrd/init.py#L138
and i will try to make this module compatible with new version of xlrd, please be patient
hi @wlin-kencove, i found out where the problem is. the error is in the
xlrdlibrary in the new version (which is no longer available with .xlsx file type), see: https://github.com/python-excel/xlrd/blob/0c4e80b3d48dfe2250ac4e514c8231a742fee221/xlrd/init.py#L138and i will try to make this module compatible with new version of
xlrd, please be patient
Ah I see, versions before 2.00 could read xlsx but afterwards it only reads xls. Our difference experiences must be due to the difference in versions. Maybe something like openpyxl could be a replacement?
hi @wlin-kencove, i added some updates to fix import error with xlrd. can you check again?
@xaviedoanhduy
Looks like that did it works for me now. Thanks for taking a look!
@xaviedoanhduy : Test Case 1:
- Try to update "account.move" record using following configuration("Settings > Technical > Excel Import/Export > XLSX Templates") using attached excel template file.
- Following error occurs when try to update "account.move" record("Accounting > Accounting > Journal Entries"):
Test Case 2:
- Try to update "account.move" records using following configuration("Settings > Technical > Excel Import/Export > XLSX Templates") using attached excel template file:
- Field not set properly when try to update "account.move" record("Accounting > Accounting > Journal Entries"):
ping @xaviedoanhduy
hello @BhaveshHeliconia, I see your format and configuration looks quite strange, you can refer to my following sample based on the information you want to import
In Input Instruction (Dict.) page
{
'__EXPORT__': {
'Sheet1': {
'_HEAD_': {
'B1': 'ref',
'B2': 'date',
},
'line_ids': {
'A5': 'account_id.display_name',
'B5': 'partner_id.display_name',
'C5': 'name',
'D5': 'credit',
'E5': 'debit',
}
}
},
'__IMPORT__': {
'Sheet1': {
'_HEAD_': {
'B1': 'ref',
'B2': 'date',
},
'_NODEL_line_ids': {
'A5': 'account_id',
'B5': 'partner_id',
'C5': 'name',
'D5': 'credit',
'E5': 'debit',
}
}
},
# '__POST_IMPORT__': '${object.post_import_do_something()}',
}
the file content should be:
input file should like this
@xaviedoanhduy : I've tried to import with the sample described by you, but still it's not working. I've attached video showing steps I've performed and error and also attached excel files I've used in this video.
https://github.com/user-attachments/assets/c816f7fe-8737-4e49-ad70-6160b3254066
@BhaveshHeliconia, do you have the same problem locally but on a different version? FYI, i checked on runboat and everything is working
@xaviedoanhduy : It's working fine now. I think it was missing this commit: https://github.com/OCA/server-tools/pull/3207/commits/fbbf238e70edb996901f60254ae8c345b54bc8d2
Functional test LGTM!!
@OCA/tools-maintainers Please, can you merge this PR?
/ocabot merge nobump
Hey, thanks for contributing! Proceeding to merge this for you. Prepared branch 18.0-ocabot-merge-pr-3207-by-thomaspaulb-bump-nobump, awaiting test results.
Congratulations, your PR was merged at e40eeb5a4928ced98c107a9a4225ed1d4dfa5ba8. Thanks a lot for contributing to OCA. ❤️