Skip to content
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

[18.0][MIG] excel_import_export: Migration to 18.0 #3207

Open
wants to merge 114 commits into
base: 18.0
Choose a base branch
from

Conversation

xaviedoanhduy
Copy link

@wlin-kencove
Copy link

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:

image

When opened the files seem to be correct but they cannot be used for imports:
image

Error on trying to import file:
image

@wlin-kencove
Copy link

wlin-kencove commented Feb 24, 2025

Manually adding .xlsx does not fix the import error

image image

@xaviedoanhduy xaviedoanhduy force-pushed the 18.0-mig-excel_import_export branch from d99e929 to a2f28bf Compare February 25, 2025 04:31
@xaviedoanhduy
Copy link
Author

xaviedoanhduy commented Feb 25, 2025

hi @wlin-kencove, fixed the above errors.

@xaviedoanhduy xaviedoanhduy force-pushed the 18.0-mig-excel_import_export branch 2 times, most recently from 23111d6 to 193bc88 Compare February 25, 2025 05:28
@wlin-kencove
Copy link

wlin-kencove commented Feb 25, 2025

The export looks good now, though the import is still displaying errors for me:
image

I am using the file exported without editing it. I have it attached if it helps:
S00001.xlsx

@wlin-kencove
Copy link

image

This is what I am passing.

This is the error
image

This is the file.
S00001.xlsx

@xaviedoanhduy
Copy link
Author

xaviedoanhduy commented Feb 26, 2025

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

kittiu and others added 19 commits February 26, 2025 17:10
* [ADD] v12 excel_import_export

* Change from eval() to safe_evel()

* Change variable to format to style, as fomat is a common python function

:100644 100644 00ee3d9f... e9e48d87... M	excel_import_export/models/common.py
:100644 100644 a215d29b... 5b4d1fb1... M	excel_import_export/models/styles.py
:100644 100644 ace11a32... 01e5b9f5... M	excel_import_export/models/xlsx_export.py
:100644 100644 881b814f... cadfb0f2... M	excel_import_export/models/xlsx_import.py
:100644 100644 58689ee5... 80490ce8... M	excel_import_export/models/xlsx_template.py
:100644 100644 5c9c09a6... a363ad19... M	excel_import_export/views/xlsx_template_view.xml
:100644 100644 475b5187... 392fe6e5... M	excel_import_export_demo/import_export_sale_order/templates.xml
:100644 100644 4af9c519... 45ee33c6... M	excel_import_export_demo/report_sale_order/templates.xml

:100644 100644 96157ea3... 17d3964d... M	excel_import_export/__manifest__.py
:100644 100644 00ee3d9f... 51c2572a... M	excel_import_export/models/common.py
:100644 100644 a215d29b... 5b4d1fb1... M	excel_import_export/models/styles.py
:100644 100644 ace11a32... 185a3330... M	excel_import_export/models/xlsx_export.py
:100644 100644 881b814f... cadfb0f2... M	excel_import_export/models/xlsx_import.py
:100644 100644 58689ee5... 80490ce8... M	excel_import_export/models/xlsx_template.py
:100644 100644 5c9c09a6... a363ad19... M	excel_import_export/views/xlsx_template_view.xml
:100644 100644 475b5187... 392fe6e5... M	excel_import_export_demo/import_export_sale_order/templates.xml
:100644 100644 4af9c519... 45ee33c6... M	excel_import_export_demo/report_sale_order/templates.xml

:100644 100644 96157ea3... 933ce0dc... M	excel_import_export/__manifest__.py
:100644 100644 00ee3d9f... 51c2572a... M	excel_import_export/models/common.py
:100644 100644 a215d29b... 5b4d1fb1... M	excel_import_export/models/styles.py
:100644 100644 ace11a32... 185a3330... M	excel_import_export/models/xlsx_export.py
:100644 100644 881b814f... cadfb0f2... M	excel_import_export/models/xlsx_import.py
:100644 100644 58689ee5... 80490ce8... M	excel_import_export/models/xlsx_template.py
:100644 100644 5c9c09a6... a363ad19... M	excel_import_export/views/xlsx_template_view.xml
:100644 100644 475b5187... 392fe6e5... M	excel_import_export_demo/import_export_sale_order/templates.xml
:100644 100644 4af9c519... 45ee33c6... M	excel_import_export_demo/report_sale_order/templates.xml

:100644 100644 96157ea3 3b1217e8 M	excel_import_export/__manifest__.py
:100644 100644 00ee3d9f 51c2572a M	excel_import_export/models/common.py
:100644 100644 a215d29b 5b4d1fb1 M	excel_import_export/models/styles.py
:100644 100644 ace11a32 185a3330 M	excel_import_export/models/xlsx_export.py
:100644 100644 881b814f cadfb0f2 M	excel_import_export/models/xlsx_import.py
:100644 100644 58689ee5 80490ce8 M	excel_import_export/models/xlsx_template.py
:100644 100644 5c9c09a6 a363ad19 M	excel_import_export/views/xlsx_template_view.xml
:100644 100644 475b5187 392fe6e5 M	excel_import_export_demo/import_export_sale_order/templates.xml
:100644 100644 4af9c519 45ee33c6 M	excel_import_export_demo/report_sale_order/templates.xml

:100644 100644 96157ea3 fee958bc M	excel_import_export/__manifest__.py
:100644 100644 00ee3d9f 51c2572a M	excel_import_export/models/common.py
:100644 100644 a215d29b 5b4d1fb1 M	excel_import_export/models/styles.py
:100644 100644 ace11a32 185a3330 M	excel_import_export/models/xlsx_export.py
:100644 100644 881b814f cadfb0f2 M	excel_import_export/models/xlsx_import.py
:100644 100644 58689ee5 80490ce8 M	excel_import_export/models/xlsx_template.py
:100644 100644 5c9c09a6 a363ad19 M	excel_import_export/views/xlsx_template_view.xml
:100644 100644 475b5187 392fe6e5 M	excel_import_export_demo/import_export_sale_order/templates.xml
:100644 100644 4af9c519 45ee33c6 M	excel_import_export_demo/report_sale_order/templates.xml

:100644 100644 96157ea3 fee958bc M	excel_import_export/__manifest__.py
:100644 100644 00ee3d9f 51c2572a M	excel_import_export/models/common.py
:100644 100644 a215d29b 9738a3c8 M	excel_import_export/models/styles.py
:100644 100644 ace11a32 a7d6adc5 M	excel_import_export/models/xlsx_export.py
:100644 100644 881b814f 12f9ca99 M	excel_import_export/models/xlsx_import.py
:100644 100644 70c37799 f123d2a6 M	excel_import_export/models/xlsx_report.py
:100644 100644 58689ee5 578a1fd8 M	excel_import_export/models/xlsx_template.py
:100644 100644 5c9c09a6 a363ad19 M	excel_import_export/views/xlsx_template_view.xml
:100644 100644 800ea573 1807ea7e M	excel_import_export/wizard/export_xlsx_wizard.py
:100644 100644 febed8d0 750dc17e M	excel_import_export/wizard/import_xlsx_wizard.py
:100644 100644 475b5187 392fe6e5 M	excel_import_export_demo/import_export_sale_order/templates.xml
:100644 100644 8e40a2d0 21574896 M	excel_import_export_demo/report_sale_order/report_sale_order.py
:100644 100644 4af9c519 45ee33c6 M	excel_import_export_demo/report_sale_order/templates.xml

:100644 100644 96157ea3 fee958bc M	excel_import_export/__manifest__.py
:100644 100644 00ee3d9f 51c2572a M	excel_import_export/models/common.py
:100644 100644 a215d29b 9738a3c8 M	excel_import_export/models/styles.py
:100644 100644 ace11a32 c7db3f92 M	excel_import_export/models/xlsx_export.py
:100644 100644 881b814f 12f9ca99 M	excel_import_export/models/xlsx_import.py
:100644 100644 70c37799 f123d2a6 M	excel_import_export/models/xlsx_report.py
:100644 100644 58689ee5 578a1fd8 M	excel_import_export/models/xlsx_template.py
:100644 100644 5c9c09a6 a363ad19 M	excel_import_export/views/xlsx_template_view.xml
:100644 100644 800ea573 1807ea7e M	excel_import_export/wizard/export_xlsx_wizard.py
:100644 100644 febed8d0 750dc17e M	excel_import_export/wizard/import_xlsx_wizard.py
:100644 100644 475b5187 392fe6e5 M	excel_import_export_demo/import_export_sale_order/templates.xml
:100644 100644 8e40a2d0 21574896 M	excel_import_export_demo/report_sale_order/report_sale_order.py
:100644 100644 4af9c519 45ee33c6 M	excel_import_export_demo/report_sale_order/templates.xml

:100644 100644 96157ea3 fee958bc M	excel_import_export/__manifest__.py
:100644 100644 00ee3d9f 51c2572a M	excel_import_export/models/common.py
:100644 100644 a215d29b 9738a3c8 M	excel_import_export/models/styles.py
:100644 100644 ace11a32 c7db3f92 M	excel_import_export/models/xlsx_export.py
:100644 100644 881b814f 12f9ca99 M	excel_import_export/models/xlsx_import.py
:100644 100644 70c37799 f123d2a6 M	excel_import_export/models/xlsx_report.py
:100644 100644 58689ee5 e3826e08 M	excel_import_export/models/xlsx_template.py
:000000 100644 00000000 34aa53bf A	excel_import_export/tests/__init__.py
:000000 100644 00000000 18618688 A	excel_import_export/tests/sale_order.xlsx
:000000 100644 00000000 c8481487 A	excel_import_export/tests/test_xlsx_template.py
:100644 100644 5c9c09a6 a363ad19 M	excel_import_export/views/xlsx_template_view.xml
:100644 100644 800ea573 1807ea7e M	excel_import_export/wizard/export_xlsx_wizard.py
:100644 100644 febed8d0 750dc17e M	excel_import_export/wizard/import_xlsx_wizard.py
:100644 100644 475b5187 392fe6e5 M	excel_import_export_demo/import_export_sale_order/templates.xml
:100644 100644 8e40a2d0 21574896 M	excel_import_export_demo/report_sale_order/report_sale_order.py
:100644 100644 4af9c519 45ee33c6 M	excel_import_export_demo/report_sale_order/templates.xml

:100644 100644 96157ea3 fee958bc M	excel_import_export/__manifest__.py
:100644 100644 00ee3d9f 51c2572a M	excel_import_export/models/common.py
:100644 100644 a215d29b 9738a3c8 M	excel_import_export/models/styles.py
:100644 100644 ace11a32 c7db3f92 M	excel_import_export/models/xlsx_export.py
:100644 100644 881b814f 12f9ca99 M	excel_import_export/models/xlsx_import.py
:100644 100644 70c37799 f123d2a6 M	excel_import_export/models/xlsx_report.py
:100644 100644 58689ee5 ed8c9fc7 M	excel_import_export/models/xlsx_template.py
:000000 100644 00000000 34aa53bf A	excel_import_export/tests/__init__.py
:000000 100644 00000000 18618688 A	excel_import_export/tests/sale_order.xlsx
:000000 100644 00000000 69aa6ea0 A	excel_import_export/tests/test_xlsx_template.py
:100644 100644 5c9c09a6 a363ad19 M	excel_import_export/views/xlsx_template_view.xml
:100644 100644 800ea573 1807ea7e M	excel_import_export/wizard/export_xlsx_wizard.py
:100644 100644 febed8d0 750dc17e M	excel_import_export/wizard/import_xlsx_wizard.py
:100644 100644 475b5187 392fe6e5 M	excel_import_export_demo/import_export_sale_order/templates.xml
:100644 100644 8e40a2d0 21574896 M	excel_import_export_demo/report_sale_order/report_sale_order.py
:100644 100644 4af9c519 45ee33c6 M	excel_import_export_demo/report_sale_order/templates.xml

:100644 100644 96157ea3 fee958bc M	excel_import_export/__manifest__.py
:100644 100644 00ee3d9f 51c2572a M	excel_import_export/models/common.py
:100644 100644 a215d29b 9738a3c8 M	excel_import_export/models/styles.py
:100644 100644 ace11a32 c7db3f92 M	excel_import_export/models/xlsx_export.py
:100644 100644 881b814f 933d8614 M	excel_import_export/models/xlsx_import.py
:100644 100644 70c37799 f123d2a6 M	excel_import_export/models/xlsx_report.py
:100644 100644 58689ee5 1460473a M	excel_import_export/models/xlsx_template.py
:100644 100644 5c9c09a6 a363ad19 M	excel_import_export/views/xlsx_template_view.xml
:100644 100644 800ea573 1807ea7e M	excel_import_export/wizard/export_xlsx_wizard.py
:100644 100644 febed8d0 750dc17e M	excel_import_export/wizard/import_xlsx_wizard.py
:100644 100644 a2d035ef 9463f279 M	excel_import_export_demo/__manifest__.py
:100644 100644 475b5187 e7f1255b M	excel_import_export_demo/import_export_sale_order/templates.xml
:100644 100644 8e40a2d0 21574896 M	excel_import_export_demo/report_sale_order/report_sale_order.py
:100644 100644 4af9c519 45ee33c6 M	excel_import_export_demo/report_sale_order/templates.xml
:000000 100644 00000000 79db62f7 A	excel_import_export_demo/tests/__init__.py
:000000 100644 00000000 18618688 A	excel_import_export_demo/tests/sale_order.xlsx
:000000 100644 00000000 c9733b95 A	excel_import_export_demo/tests/test_common.py
:000000 100644 00000000 9c943768 A	excel_import_export_demo/tests/test_xlsx_import_export.py
:000000 100644 00000000 730605c1 A	excel_import_export_demo/tests/test_xlsx_template.py

:100644 100644 96157ea3 fee958bc M	excel_import_export/__manifest__.py
:100644 100644 00ee3d9f 51c2572a M	excel_import_export/models/common.py
:100644 100644 a215d29b 9738a3c8 M	excel_import_export/models/styles.py
:100644 100644 ace11a32 c7db3f92 M	excel_import_export/models/xlsx_export.py
:100644 100644 881b814f 933d8614 M	excel_import_export/models/xlsx_import.py
:100644 100644 70c37799 f123d2a6 M	excel_import_export/models/xlsx_report.py
:100644 100644 58689ee5 1460473a M	excel_import_export/models/xlsx_template.py
:100644 100644 5c9c09a6 a363ad19 M	excel_import_export/views/xlsx_template_view.xml
:100644 100644 800ea573 1807ea7e M	excel_import_export/wizard/export_xlsx_wizard.py
:100644 100644 febed8d0 750dc17e M	excel_import_export/wizard/import_xlsx_wizard.py
:100644 100644 a2d035ef 9463f279 M	excel_import_export_demo/__manifest__.py
:100644 100644 475b5187 e7f1255b M	excel_import_export_demo/import_export_sale_order/templates.xml
:100644 100644 8e40a2d0 21574896 M	excel_import_export_demo/report_sale_order/report_sale_order.py
:100644 100644 4af9c519 45ee33c6 M	excel_import_export_demo/report_sale_order/templates.xml
:000000 100644 00000000 79db62f7 A	excel_import_export_demo/tests/__init__.py
:000000 100644 00000000 18618688 A	excel_import_export_demo/tests/sale_order.xlsx
:000000 100644 00000000 bb3ea32e A	excel_import_export_demo/tests/test_common.py
:000000 100644 00000000 9c943768 A	excel_import_export_demo/tests/test_xlsx_import_export.py
:000000 100644 00000000 730605c1 A	excel_import_export_demo/tests/test_xlsx_template.py
wrong use of dict.iteritems() for python3
Fix Import Excel wizard, cannot download template as in v12
core Odoo prevent download default binary.
Add report action feature and new examples
When mark to convert xlsx to csv, csv file name is not used
mymage and others added 21 commits February 26, 2025 17:10
Currently translated at 100.0% (194 of 194 strings)

Translation: server-tools-16.0/server-tools-16.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-excel_import_export/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-tools-16.0/server-tools-16.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-excel_import_export/
Currently translated at 100.0% (203 of 203 strings)

Translation: server-tools-16.0/server-tools-16.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-excel_import_export/it/
Currently translated at 100.0% (203 of 203 strings)

Translation: server-tools-16.0/server-tools-16.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-excel_import_export/it/
Currently translated at 100.0% (203 of 203 strings)

Translation: server-tools-16.0/server-tools-16.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-excel_import_export/it/
This commit fixes issue of finding multiple records across all companies during import when they have same record name.
Previously, importing with sudo could bypass multi-company record rules.
Currently translated at 100.0% (203 of 203 strings)

Translation: server-tools-16.0/server-tools-16.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-excel_import_export/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-tools-16.0/server-tools-16.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-excel_import_export/
Currently translated at 100.0% (204 of 204 strings)

Translation: server-tools-16.0/server-tools-16.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-excel_import_export/it/
…l related templates for export action

Before this commit, when two templates exist for the same model, clicking "ADD EXPORT ACTION" for each template
creates separate server actions for each. As a result, if multiple templates are created for the same model,
numerous server actions with the label "Export Excel" will accumulate for that model.
With this commit, if two templates exist for the same model and "ADD EXPORT ACTION" is clicked for each,
they will now share a single server action. Users can then select templates from within the "Export Excel" wizard.
Clicking "REMOVE EXPORT ACTION" on a template will remove only that template from the "Export Excel" selection.
The server action itself will be deleted only when no templates use it for export.
Currently translated at 100.0% (204 of 204 strings)

Translation: server-tools-16.0/server-tools-16.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-excel_import_export/it/
@xaviedoanhduy xaviedoanhduy force-pushed the 18.0-mig-excel_import_export branch from 193bc88 to 8c33a4a Compare February 26, 2025 10:11
@wlin-kencove
Copy link

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

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?

[18.0][IMP] excel_import_export: replace reading excel file from xlrd with openpyxl
@xaviedoanhduy
Copy link
Author

hi @wlin-kencove, i added some updates to fix import error with xlrd. can you check again?

@wlin-kencove
Copy link

image

@xaviedoanhduy

Looks like that did it works for me now. Thanks for taking a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.