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

[16.0][MIG] excel_import_export, excel_import_export_demo: Migration to 16.0 #2505

Closed
wants to merge 88 commits into from

Conversation

AungKoKoLin1997
Copy link
Contributor

@AungKoKoLin1997 AungKoKoLin1997 commented Dec 20, 2022

kittiu and others added 30 commits December 20, 2022 12:06
* [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
Currently translated at 2.9% (5 of 170 strings)

Translation: server-tools-12.0/server-tools-12.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-excel_import_export/zh_CN/
Currently translated at 24.1% (41 of 170 strings)

Translation: server-tools-12.0/server-tools-12.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-excel_import_export/zh_CN/
Currently translated at 100.0% (170 of 170 strings)

Translation: server-tools-12.0/server-tools-12.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-excel_import_export/zh_CN/
Currently translated at 100.0% (170 of 170 strings)

Translation: server-tools-12.0/server-tools-12.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-excel_import_export/zh_CN/
Previously export is slow on large number of rows.
This fix ensure that sheet.insert_rows is called only once for all rows,
instead of insert 1 row for every rows
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Translation: server-tools-12.0/server-tools-12.0-excel_import_export
Translate-URL: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-excel_import_export/
@AungKoKoLin1997 AungKoKoLin1997 marked this pull request as ready for review December 21, 2022 03:09
Copy link

@kanda999 kanda999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function review: it worked as expected in my environment.

@youring
Copy link

youring commented Feb 17, 2023

There are three same warnings when install the module:

2023-02-17 02:07:56,322 3666754 WARNING v16 odoo.api.create: The model odoo.addons.excel_import_export.models.xlsx_template is not overriding the create method in batch
2023-02-17 02:07:56,323 3666754 WARNING v16 odoo.api.create: The model odoo.addons.excel_import_export.models.xlsx_template is not overriding the create method in batch
2023-02-17 02:07:56,323 3666754 WARNING v16 odoo.api.create: The model odoo.addons.excel_import_export.models.xlsx_template is not overriding the create method in batch

@gaikaz
Copy link
Member

gaikaz commented Mar 22, 2023

@AungKoKoLin1997
Could you please check those warnings youring mentioned?

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 16.0-mig-excel_import_export branch from a1e6edf to 43b5ad6 Compare March 22, 2023 10:06
@AungKoKoLin1997
Copy link
Contributor Author

AungKoKoLin1997 commented Mar 22, 2023

@youring @gaikaz
Thanks for the review. You can see the update in the last commit

@Dariosi
Copy link

Dariosi commented Mar 22, 2023

@AungKoKoLin1997
This commit solves 1 out of 3 warning issues.
I guess the same should be done here and here
(xlsx_template.py: 557, 605)

Copy link
Member

@gaikaz gaikaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that everything else should be OK.
We are testing the module for where we use it and apart from this one bug, it functionally works.

Comment on lines 46 to 51
report_name = safe_eval(
report.print_report_name, {"object": records, "time": time}
)
# this is a bad idea, this sould only be .xlsx
extension = report_name.split(".")[-1:].pop()
report_name = f"{report_name}.{extension}"
Copy link
Member

@gaikaz gaikaz Mar 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AungKoKoLin1997
It seems that you took the module while it was still in migration to Odoo 15 (#2329).
Before it was fully done, there were some force-pushes that fixed some code.
The forced commit: f94ba4f#diff-db4160b3be01859e4c870cbbce8305e536fd4b5cad80ce3812b8e7a187aafccfR51-R56
The compare between force-pushed and commit before: https://github.com/OCA/server-tools/compare/88258a039d89c9050311a65c78cd7ae679c1463d..5f43f4d41911488b92b84aaf71b968e0b2ab13dd
Please also look what else changed.

While migrating, @Mantux11 made an error that switched the lines around. That started generating bad file names. Then he force-pushed to switch them back.
It looks like you took the code before it was fixed.

TLDR:

Suggested change
report_name = safe_eval(
report.print_report_name, {"object": records, "time": time}
)
# this is a bad idea, this sould only be .xlsx
extension = report_name.split(".")[-1:].pop()
report_name = f"{report_name}.{extension}"
# this is a bad idea, this should only be .xlsx
extension = report_name.split(".")[-1:].pop()
report_name = safe_eval(
report.print_report_name, {"object": records, "time": time}
)
report_name = f"{report_name}.{extension}"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I worked on these modules while it was still in migration to 15.0. I added the commit for adjustment.


registry
.category("ir.actions.report handlers")
.add("xlsx_handler", async function (action, options, env) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Writing the last comment, found this too.

This is wrong, because it conflicts with another OCA module report_xlsx.
It also registers it's handler by the same name here:
https://github.com/OCA/reporting-engine/blob/16.0/report_xlsx/static/src/js/report/action_manager_report.esm.js#L8

If left like this, if you install both modules, only one handler (last installed) will be working and Odoo should be giving errors in the browser DevTools console.

Suggested change
.add("xlsx_handler", async function (action, options, env) {
.add("excel_handler", async function (action, options, env) {

Copy link
Member

@gaikaz gaikaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review + quick functional test.

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@gaikaz
Copy link
Member

gaikaz commented Mar 27, 2023

@OCA/server-environment-maintainers
Could we get an approve/merge from a maintainer please 🙏🏻

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 16.0-mig-excel_import_export branch from ac5ab44 to 3d4e6e5 Compare April 11, 2023 10:24
@gaikaz
Copy link
Member

gaikaz commented Apr 17, 2023

@AungKoKoLin1997 This is definitely all ready for review, right?
I already approved, as we depend on this module and AFAIK, it works as intended.

@AungKoKoLin1997
Copy link
Contributor Author

@gaikaz Of course. This PR was ready for review. I don't know why still not get merged.

@gaikaz
Copy link
Member

gaikaz commented Apr 18, 2023

@OCA/tools-maintainers
I suppose I pinged the wrong team before.
Could we get a look at this 🙏🏻 Thank you

@thomaspaulb
Copy link
Contributor

/ocabot migration excel_import_export
/ocabot migration excel_import_export_demo
/ocabot merge nobump

@OCA-git-bot OCA-git-bot modified the milestone: 16.0 Apr 18, 2023
@OCA-git-bot OCA-git-bot mentioned this pull request Apr 18, 2023
33 tasks
@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-2505-by-thomaspaulb-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Apr 18, 2023
Signed-off-by thomaspaulb
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at e04a819. Thanks a lot for contributing to OCA. ❤️

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

Successfully merging this pull request may close these issues.