-
-
Notifications
You must be signed in to change notification settings - Fork 179
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] l10n_eu_nace new ShowVoc integration #196
Conversation
Short category names are now displayed on partner views, since NACE names are so long
Data files were there, but translations were not.
[ADD] setup.py
[12.0][IMP] - Add unit tests [IMP] - code improve Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/migrations/12.0.2.0.0/pre-migration.py Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/migrations/12.0.2.0.0/post-migration.py Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/models/res_partner_nace.py Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/models/res_partner_nace.py Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/models/res_partner_nace.py Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/models/res_partner_nace.py Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/models/res_partner.py Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/models/res_partner_nace.py Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/views/res_partner.xml Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/readme/CONTRIBUTORS.rst Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/models/res_partner_nace.py Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/models/res_partner_nace.py Co-authored-by: Jairo Llopis <[email protected]> [FIX] - fix code Update l10n_eu_nace/models/res_partner_nace.py Co-authored-by: Jairo Llopis <[email protected]> [FIX] - Fix name_search
Fix post-migration Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/models/res_partner_nace.py Co-authored-by: Jairo Llopis <[email protected]> Update l10n_eu_nace/models/res_partner_nace.py Co-authored-by: Jairo Llopis <[email protected]>
Some need to add secondary NACE codes to partners. This is a very little addition, possibly quite standard, so it's done directly in the base addon. @Tecnativa TT17678
FIX + IMP : more readable query for updating partners with new xml_id regarding old xml_id
I’ve just tested the module. The wizard need rework. There’s a save/discard button on the bottom and in the centre a big Import button. The import button need to replace the save button, and in the middle a text indicating what would happen would be best. The import is fast. After import, the list of industries is not shown, so it feels like it did not work. I expected the list of industries to be shown again. Importing again works as expected. If a language is added, the wizard needs to be run again. It should be indicated in the readme, or automatically done when a new language is activated. I was also surprised that the module did not run the import during installation. Odoo SA split the name and full name, only adding the code in the full name. I expected this module to do the same. The list of industries is also strangely sorted, but I think that has nothing to do with this module. |
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.
Thank you @edlopen for this pr. Some changes.
l10n_eu_nace/readme/USAGE.rst
Outdated
NACE Wizard. This will search for all active languages in Odoo and import the | ||
data for each one. | ||
|
||
1. Go to "Contacts" > "Configuration" > "Import NACE Wizard" |
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.
1. Go to "Contacts" > "Configuration" > "Import NACE Wizard" | |
1. Go to "Contacts" > "Configuration" > "Import NACE industries" |
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.
Done!
<form string="Import NACE industries"> | ||
<sheet> | ||
<group> | ||
<button |
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.
Maybe the button should be in the footer. Also, in the sheet it would be nice to put an informative text.
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.
Done!
bindings = nace_json.get("results", {}).get("bindings", {}) | ||
for binding in bindings: | ||
nace_code = binding.get("code", {}).get("value", "") | ||
nace_id = self.env["res.partner.industry"].search( |
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.
A search in a for can be a bottleneck. You could map them earlier.
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.
Done! Thanks for your review @EmilioPascual
@edlopen thanks already for this PR. I just reviewed all your code and I honestly admit that yours is much better. However, following the same logic as @vincent-hatakeyama, in Odoo's code base the full name is obtained by combining the code and the name. And what's more, once you have imported the data, you have the impression that nothing happens afterwards, no popup to explain that your code works perfectly 😀 and no list either to display the imported data. 👍 |
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.
Absolutely amazing!
Some comments though.
l10n_eu_nace/__manifest__.py
Outdated
"depends": ["contacts"], | ||
"maintainers": ["rafaelbn", "yajo", "edlopen"], | ||
"depends": ["partner_industry_secondary"], | ||
"external_dependencies": {"python": ["requests"]}, |
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.
suggestion: remove this implicit dependency, as Odoo 16 already requires 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.
Done!
l10n_eu_nace/readme/USAGE.rst
Outdated
http://ec.europa.eu/eurostat/ramon/nomenclatures/index.cfm?TargetUrl=LST_CLS_DLD&StrNom=NACE_REV2&StrLanguageCode=FR&StrLayoutCode=# | ||
If you want to import or update the data, you can do so by running the Import | ||
NACE Wizard. This will search for all active languages in Odoo and import the | ||
data for each one. |
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.
data for each one. | |
data for each one. If you activate a new language, remember to run this wizard again. |
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.
Done!
import_wizard = wizard.save() | ||
return import_wizard | ||
|
||
@users("test-manager") |
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.
suggestion: You can remove this decorator, if you follow my suggestion above in setUpClass
. The same applies for all other uses of @users
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.
Done!
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.user = new_test_user( |
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.
suggestion: change this to implicitly change the tests env from here onwards:
cls.user = new_test_user( | |
cls.uid = new_test_user( |
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.
Done! Thanks for your review @yajo
9862788
to
83c94c1
Compare
83c94c1
to
42e2788
Compare
@vincent-hatakeyama @aronabencherif I've updated the wizard and now after installation the import wizard will appear. Also the names and full names are different, with the full names being the code and the nace name. Finally, after running the wizard, the industry tree view is displayed. I hope this make the module more clear and easy to use. Thank you for your reviews! |
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.
Co-authored-by: Jairo Llopis <[email protected]>
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.
Great job! Thank you!
This PR has the |
/ocabot merge patch |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at 86a5f9a. Thanks a lot for contributing to OCA. ❤️ |
I forgot to add a migration script so that the data is not lost from the res.partner. Currently working to add it in a separate issue and PR. Thank you all. |
Hello you all,
this is a migration and a refactor of the l10n_eu_nace module. Since the RAMON servers from we get te csv data are deprecated this PR contains the functionality to get the data directly from the new ShowVoc web catalogue in the format of a SPARQL endpoint. This get the industries and their translation by a API request and by running a simple wizard.
I would appreciate that this PR is merged rather quickly as it's my intention to migrate similar modules that relays on this new ShowVoc dataset.
Also I included this stale PR's commit.
@moduon MT-1816
@yajo @EmilioPascual @Shide @rafaelbn review this PR when you can.