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

[15.0][MIG] connector_importer_product #94

Merged
merged 24 commits into from
Mar 6, 2023

Conversation

simahawk
Copy link
Contributor

@simahawk simahawk commented Jul 15, 2022

Module moved as-is to 15.0 here #99

Depends on:

TODO:

  • finish testing

Overall:

  • removed a lot of custom code thanks to the dynamic mapper
  • update configuration of default import types
  • improved and fixed product and supplier importers
  • added tests

See atomic commits for details.

@simahawk
Copy link
Contributor Author

/ocabot migration connector_importer_product

@OCA-git-bot OCA-git-bot added this to the 15.0 milestone Jul 15, 2022
@OCA-git-bot OCA-git-bot mentioned this pull request Jul 15, 2022
4 tasks
@simahawk simahawk force-pushed the 15-conn-importer-product branch 2 times, most recently from 92a5b6d to 8eff96e Compare November 8, 2022 08:45
@simahawk simahawk marked this pull request as ready for review March 2, 2023 10:35
@simahawk simahawk force-pushed the 15-conn-importer-product branch 2 times, most recently from be05f63 to d665eec Compare March 2, 2023 10:54
@simahawk
Copy link
Contributor Author

simahawk commented Mar 2, 2023

I'm experimenting w/ pyopenssl upgrade. BTW there's s pending PR on master here odoo/odoo#95782

Error w/o upgrade:

Traceback (most recent call last):
  File "/opt/odoo/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
  File "/opt/odoo/odoo/modules/loading.py", line 415, in load_modules
    loaded_modules, processed_modules = load_module_graph(
  File "/opt/odoo/odoo/modules/loading.py", line 179, in load_module_graph
    load_openerp_module(package.name)
  File "/opt/odoo/odoo/modules/module.py", line 396, in load_openerp_module
    __import__('odoo.addons.' + module_name)
  File "/opt/odoo/odoo/addons/base/__init__.py", line 5, in <module>
    from . import models
  File "/opt/odoo/odoo/addons/base/models/__init__.py", line 23, in <module>
    from . import ir_mail_server
  File "/opt/odoo/odoo/addons/base/models/ir_mail_server.py", line 19, in <module>
    from OpenSSL import crypto as SSLCrypto
  File "/opt/odoo-venv/lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/opt/odoo-venv/lib/python3.8/site-packages/OpenSSL/crypto.py", line 1553, in <module>
    class X509StoreFlags(object):
  File "/opt/odoo-venv/lib/python3.8/site-packages/OpenSSL/crypto.py", line 1573, in X509StoreFlags
    CB_ISSUER_CHECK = _lib.X509_V_FLAG_CB_ISSUER_CHECK
AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'

Error w/ 21.0.0, now testing 20.0.

2023-03-02 10:50:48,297 236 ERROR odoo odoo.modules.registry: Failed to load registry 
2023-03-02 10:50:48,297 236 CRITICAL odoo odoo.service.server: Failed to initialize database `odoo`. 
Traceback (most recent call last):
  File "/opt/odoo/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
  File "/opt/odoo/odoo/modules/loading.py", line 415, in load_modules
    loaded_modules, processed_modules = load_module_graph(
  File "/opt/odoo/odoo/modules/loading.py", line 179, in load_module_graph
    load_openerp_module(package.name)
  File "/opt/odoo/odoo/modules/module.py", line 396, in load_openerp_module
    __import__('odoo.addons.' + module_name)
  File "/opt/odoo/odoo/addons/base/__init__.py", line 5, in <module>
    from . import models
  File "/opt/odoo/odoo/addons/base/models/__init__.py", line 23, in <module>
    from . import ir_mail_server
  File "/opt/odoo/odoo/addons/base/models/ir_mail_server.py", line 19, in <module>
    from OpenSSL import crypto as SSLCrypto
  File "/opt/odoo-venv/lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/opt/odoo-venv/lib/python3.8/site-packages/OpenSSL/crypto.py", line 3279, in <module>
    _lib.OpenSSL_add_all_algorithms()
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'

These versions work:

pyopenssl==20.0.0
cryptography==35.0.0

@simahawk
Copy link
Contributor Author

simahawk commented Mar 6, 2023

Fixed here OCA/storage#248

The mapper now uses the dynanic mapper to automatically
find and convert values from source to destination.

We can trash many direct mappings!

Additionally, the supplier is now imported automatically.
`prod.product_template_attribute_value_ids` must be set using _only_ valid values.
To find them, we must use `_without_no_variant_attribute()`
as Odoo does in relevant places.

`combination_indices` depends on `product_template_attribute_value_ids`,
hence if its value is wrong the index will be wrong
and you won't find the right variant.

Additionally, when using the product configurator,
since the combination is wrong
the product won't be purchase-able or sale-able w/ the configurator.
Make import type non demo only to provide a default setup.
Allows to import product and suppliers at the same time.
@simahawk
Copy link
Contributor Author

simahawk commented Mar 6, 2023

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 15.0-ocabot-merge-pr-94-by-simahawk-bump-minor, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit b303404 into OCA:15.0 Mar 6, 2023
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 2f34556. 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.

None yet

2 participants