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

[14.0][ADD] connector_woocommerce - connector wordpress: New modules #323

Open
wants to merge 174 commits into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
6347f78
[ADD] connector_extension_wordpress: new module
eantones Jun 20, 2023
0f212bb
[ADD] connector_extension_woocommerce: new module
eantones Jun 20, 2023
4fcd7a6
[ADD] connector_woocommerce: New Module
KNVx May 10, 2023
7d6ee87
[ADD] connector_wordpress: New Module
KNVx May 17, 2023
2a88730
[IMP] Connector_wordpress: removed binding from parameters in _has_to…
KNVx Sep 28, 2023
e98a462
[IMP] connector_wordpress: now binding inherit from connector_extensi…
KNVx Oct 9, 2023
dffdc1f
[IMP] connector_wordpress: _get_lock_name refactored in wordpress to …
KNVx Oct 16, 2023
3b9105b
[ADD] website_sale_variant_info: New Module
KNVx Sep 14, 2023
4028b7f
[ADD] Connector_woocommerce_ast: New module
KNVx Sep 15, 2023
c5557d7
[IMP] Connector_woocommerce_ast: listener to update carrier_id and ca…
KNVx Sep 26, 2023
62fe82f
[IMP] Connector_woocommerce_ast: New states Delivered on Sale_order. …
KNVx Sep 27, 2023
6616e64
[IMP] connector_woocommerce_ast: partial-shipped renamed to partial_s…
KNVx Sep 28, 2023
2f9c09f
[IMP] Connector_woocommerce_ast: api removed from imports in stock_pi…
KNVx Oct 4, 2023
1ba81fa
[ADD] connector_woocommerce_apg_nif: New module
KNVx Sep 20, 2023
2379642
[IMP] Connector_woocommerce: Created variant filter view
KNVx Sep 22, 2023
c98f009
[IMP] Connector_woocommerce: variant_is_published on product_product …
KNVx Sep 22, 2023
f816901
[IMP] Connector_woocommerce: required default_code in product export_…
KNVx Sep 22, 2023
8e795c2
[IMP] Connector_woocommerce: template_is_published replaced for butto…
KNVx Sep 22, 2023
9a082a9
[IMP] Connector_woocommerce: Included has_attributes field in product…
KNVx Sep 26, 2023
ac5ae18
[IMP] Connector_woocommerce: Separation between simple/variant produc…
KNVx Sep 26, 2023
beb9d5c
[IMP] Connector_woocommerce: hook on listener to add more fields to u…
KNVx Sep 26, 2023
d5480df
[IMP] Connector_woocommerce: Improved string of woocommerce_fields in…
KNVx Sep 26, 2023
4abe30c
[IMP] Connector_woocommerce: language on backend is a M2o. export map…
KNVx Sep 26, 2023
d8d7438
[IMP] Connector_woocommerce: included active_test in binding fields t…
KNVx Sep 26, 2023
e4fa288
[IMP] connector_woocommerce: included compute in variant_is_published…
KNVx Sep 27, 2023
d01048a
[IMP] Connector_woocommerce: product_type in prod_tmpl export mapper …
KNVx Sep 27, 2023
00a600d
[IMP] Connector_woocommerce: woocommerce_order_state refactored.
KNVx Sep 27, 2023
fcba887
[IMP] Connector_woocommerce: included ensure_one() and removed api.mo…
KNVx Sep 28, 2023
e59dc27
[IMP] connector_woocommerce: alternative_product_ids and accessory_pr…
KNVx Oct 4, 2023
3c29c89
[IMP] Connector_woocommerce: Improved ValidationError message when pr…
KNVx Oct 5, 2023
f479eea
[IMP] Connector_woocommerce: improved ValidationError message for int…
KNVx Oct 5, 2023
be9d013
[IMP] connector_woocommerce: Inventory availability included to expor…
KNVx Oct 9, 2023
eeabe75
[FIX] connector_woocommerce: Compute woocommerce stock picking state …
KNVx Oct 9, 2023
4865aa4
[IMP] connector_woocommerce: renamed _get_filters_values function. No…
KNVx Oct 9, 2023
9ca3613
[IMP] connector_woocommerce: WooCommerce changes category names when …
KNVx Oct 9, 2023
0967cd7
[IMP] connector_woocommerce: Just validated backends are used on resync
KNVx Oct 9, 2023
0e63c85
[IMP] connector_woocommerce: woocommerce_bind_ids is included on depe…
KNVx Oct 9, 2023
e87ae5f
[IMP] connector_woocommerce: Stock status is instock when manage stoc…
KNVx Oct 10, 2023
24db313
[IMP] connector_woocommerce: Export dependencies in prod_template and…
KNVx Oct 16, 2023
bc36ce8
[IMP] connector_woocommerce: component exporter inherit from generic.…
KNVx Oct 16, 2023
1f818a5
[IMP] connector_woocommerce: new field woocommerce_enabled to export …
KNVx Oct 16, 2023
4de3a53
[ADD] website_sale_product_document: New Module
KNVx Oct 23, 2023
867a309
[IMP] connector_woocommerce: Common product class to be inhereted in …
KNVx Oct 23, 2023
4a7d719
[IMP] connector_wordpress: Renamed product_mixin and product,Read and…
KNVx Oct 23, 2023
655cd85
[IMP] connector_extension_wordpress: refactored exec_wp_call, get_tot…
KNVx Oct 24, 2023
4d2697e
[IMP] connector_extension_woocommerce: refactored exec_wcapi_call and…
KNVx Oct 24, 2023
098bbb3
[ADD] connector_woocommerce_alias_url_stream: New Module
KNVx Oct 26, 2023
30bb403
[ADD] Connector_extension_wordpress: Clean code
KNVx Oct 26, 2023
a572347
[ADD] Connector_woocommerce: minor refactor changes
KNVx Oct 26, 2023
73a10d2
[IMP] website_sale_product_document: minor refactor
KNVx Oct 26, 2023
a65abab
[IMP] connector_wordpress: Unlink binding of existing attachments
KNVx Oct 27, 2023
29ce505
[IMP] connector_woocommerce: improved prepare document description
KNVx Oct 27, 2023
973ea9f
[IMP] connector_woocommerce: commented listener
KNVx Oct 27, 2023
cdee331
[IMP] connector_woocommerce_ast: commented listener
KNVx Oct 27, 2023
3ef1c7e
[IMP] connector_woocommerce: sale_orders with binding can't be import…
KNVx Oct 30, 2023
27ee713
[IMP] connector_woocommerce: short description on mapper return None …
KNVx Oct 30, 2023
ccc78e3
Revert "[IMP] connector_woocommerce_ast: commented listener"
KNVx Oct 31, 2023
06f5f17
[IMP] connector_woocommerce: listener re-activated
KNVx Oct 31, 2023
047bb96
[IMP] connector_woocommerce: updated binders exporters and importers …
KNVx Oct 31, 2023
b57eb96
[IMP] connector_wordpress: updated binders and exporters component de…
KNVx Oct 31, 2023
3dbc79c
[IMP] connector_wocommerce: deprecated tree string removed
KNVx Nov 2, 2023
48c384b
[IMP] connector_extension_woocommerce: pre-commit readme updates
KNVx Nov 2, 2023
03e685d
[IMP] connector_extension_wordpress: pre-commit readme updates
KNVx Nov 2, 2023
9a984fc
[IMP] connector_wordpress: Included verify_ssl
eantones Jun 20, 2023
9ab3a75
[IMP] connector_woocommerce: Included verify_ssl
KNVx Dec 18, 2023
d1983bd
[IMP] connector_extension_wordpress: Included verify on requests
KNVx Dec 18, 2023
395fc62
[FIX] connector_extension_woocommerce: raise ValidationError without …
KNVx Dec 19, 2023
591b922
[FIX] connector_wordpress: Alternative bind don't use backend
KNVx Dec 19, 2023
d26ef0b
[FIX] connector_woocommerce: Accessory products with parents without …
KNVx Dec 20, 2023
1332308
[FIX] connector_woocommerce_alias_url_strem: names are exported incor…
KNVx Jun 14, 2024
7e8de97
[FIX] connector_woocommerce: Products export all variants or tmpl fro…
KNVx Jun 14, 2024
b7c75ba
[IMP] connector_woocommerce: include res partner binding page
KNVx Jun 15, 2024
5706da4
[IMP] connector_wordpress: Included wordpress attachment binding page
KNVx Jun 17, 2024
ff67157
[IMP] connector_wocommerce: included hook for mapping meta_data
KNVx Jun 17, 2024
6e0313f
[IMP] connector_woocommerce_ast: meta data is generated on adapter
KNVx Jun 17, 2024
5161820
[IMP] connector_wordpress: included export mapper odoo tools mimetypes
KNVx Jun 18, 2024
ec5d43c
[IMP] requirements.txt
KNVx Jun 18, 2024
f912fad
[ADD] connector_woocommerce_wpml: New module
KNVx Jul 9, 2024
754c02f
[IMP] connector_woocommerce: changes to make module more extensible
KNVx Jul 12, 2024
0072372
[IMP] connector_wordpress: included parameter on _additional_external…
KNVx Jul 17, 2024
501409b
[IMP] connector_woocommerce: included and improved read on products
KNVx Jul 19, 2024
333d08b
[IMP] connector_extension_woocommerce: function to manage errors
KNVx Jul 17, 2024
ed20360
[IMP] connector_extension_woocommerce: included error codes to manage…
KNVx Jul 19, 2024
5f8764a
[IMP] connector_extension_woocommerce: included hook on search_read t…
KNVx Jul 19, 2024
3c603f4
[IMP] connector_woocommerce_wpml: improved code before massive export
KNVx Jul 19, 2024
6a112f3
[IMP] connector_woocommerce
KNVx Jul 22, 2024
46b72c5
[IMP] connector_woocommerce_wpml: slug product export_mapper and impr…
KNVx Jul 29, 2024
e04110e
[IMP] connector_woocommerce: custom slug on product_template
KNVx Jul 29, 2024
7bed973
[IMP] connector_woocommerce: included website_name on product templat…
KNVx Jul 30, 2024
ce33151
[IMP] connector_woocommerce_wpml: modified mapper to convert rgb to hex
KNVx Jul 30, 2024
6908ac8
[IMP] connector_woocommerce: included html widget on product_product …
KNVx Jul 30, 2024
3c79156
[IMP] connector_extension_woocommerce - defined _exec_delete
KNVx Jul 31, 2024
6b0b3b4
[IMP] connector_woocommerce: included deleter on public category to d…
KNVx Jul 31, 2024
ac110c4
[REF] connector_woocommerce: Replaced http for https in licence url
KNVx Jul 31, 2024
ff6f47e
[REF] connector_extension_woocommerce - Replaced http for https in li…
KNVx Jul 31, 2024
fc7f007
[IMP] connector_woocommerce_wpml: aditional_external_binding_fields w…
KNVx Jul 31, 2024
7d2e441
[IMP] connector_woocommerce: removed notify from product_public_categ…
KNVx Jul 31, 2024
127f5aa
[IMP] connector_extension_woocommerce: improved manage_errors code
KNVx Aug 5, 2024
41dcc19
[IMP] connector_extension_wordpress: included manage_errors code
KNVx Aug 5, 2024
9410355
[IMP] connector_woocommerce: included public_short_description to export
KNVx Aug 5, 2024
1b025a2
[FIX] connector_wordpress: additional_external_binding_fields has ext…
KNVx Aug 5, 2024
069fdf9
[IMP] connector_woocommerce_wpml: included public short description
KNVx Aug 5, 2024
178a7d0
[IMP] connector_woocommerce: included option to use or not main image…
KNVx Aug 5, 2024
93b605f
[IMP] connector_woocommerce: improved code to use product_image_attac…
KNVx Aug 6, 2024
22ff287
[FIX] connector_woocommerce: when we delete images on odoo, images st…
KNVx Aug 7, 2024
f8dc468
[IMP] connector_woocommerce_ast: included manage errors to detect con…
KNVx Aug 8, 2024
b0fa46d
[ADD] connector_wordpress_wpml: new module
KNVx Aug 8, 2024
0dc214f
[IMP] connector_wordpress: included seo data, write on adapter and ot…
KNVx Aug 8, 2024
c3ac624
[IMP] connector_woocommerce_wpml: removed unwrap_binding, modified ma…
KNVx Aug 8, 2024
6745037
[IMP] connector_woocommerce: refactor views, deleted code, modified r…
KNVx Aug 8, 2024
4f3d582
[IMP] connector_extension_wordpress: improved post to include params …
KNVx Aug 8, 2024
388154a
[IMP] connector_woocommerce: included pricelist on backend to upload …
KNVx Aug 8, 2024
13f668c
[IMP] connector_woocommerce: return sale_price None when is not set. …
KNVx Aug 8, 2024
9034a8c
[FIX] connector_woocommerce_wpml: char fields has ondelete
KNVx Aug 8, 2024
af0523e
[FIX] connector_wordpress_wpml: code is used instead of iso_code
KNVx Aug 9, 2024
4b7a10a
[FIX] connector_wordpress: title and alternate_text can't be translated
KNVx Aug 9, 2024
0fe688b
[FIX] connector_woocommerce_wpml: iso code is used instead code
KNVx Aug 9, 2024
9a57702
[IMP] connector_woocommerce: included translations in spanish and cat…
KNVx Aug 9, 2024
ed97145
[IMP] connector_woocommerce: included information message to product …
KNVx Aug 9, 2024
fa07be9
[IMP] connector_woocommerce: use_main_product_image has now params to…
KNVx Aug 9, 2024
0e61b5d
[IMP] connector_woocommerce: move common fields to upper modules
KNVx Aug 9, 2024
bc3c790
[ADD] website_sale_extra_fields: new module
KNVx Aug 9, 2024
f23edd7
[IMP] website_sale_product_document: included documents on variant page
KNVx Aug 9, 2024
882a53f
[ADD] website_sale_stock_variant: new module
KNVx Aug 9, 2024
901bdb9
[ADD] website_sale_variant: new module
KNVx Aug 9, 2024
965cfb8
[FIX] connector_woocommerce: wrong translations
KNVx Aug 9, 2024
218e8c8
[FIX] connector_woocommerce: conflict using "_" as a dummy variable a…
eantones Aug 13, 2024
23eac24
[FIX] website_sale_extra_fields: security csv not included in manifest
eantones Aug 13, 2024
0ed851b
[IMP] connector_woocommerce: included woocommerce warning message and…
KNVx Sep 2, 2024
d380fbb
[IMP] website_sale_extra_fields: group user can create the transient …
KNVx Sep 2, 2024
909e896
[IMP] website_sale_extra_fields: modified fields for variant image at…
KNVx Sep 3, 2024
fd2cda1
[IMP] connector_woocommerce: modified fields for variant image attach…
KNVx Sep 3, 2024
25e1c94
[FIX] connector_wordpress: alternate text is not being exported
KNVx Sep 3, 2024
cacc921
[IMP] website_sale_extra_fields: Included description in product_publ…
KNVx Sep 3, 2024
bbb9a1f
[IMP] connector_woocommerce: included description in product public c…
KNVx Sep 3, 2024
c1a050c
[IMP] connector_woocommerce_wpml: included description in product pub…
KNVx Sep 3, 2024
fdbf607
[FIX] connector_woocommerce_wpml: lang is modified when lang is alrea…
KNVx Sep 3, 2024
9560ffc
[FIX] connector_woocommerce: modified rebinding by sku on product_tem…
KNVx Sep 4, 2024
0b3bbda
[IMP] connector_woocommerce_wpml: removed comments
KNVx Sep 4, 2024
fbd933d
[FIX] connector_woocommerce_wpml: res modification on search read is …
KNVx Sep 4, 2024
76dcee3
[FIX] connector_woocommerce_wpml: Pre filter lang to resync (See TODO)
KNVx Sep 4, 2024
4968bed
[IMP] website_sale_extra_fields: Included slug name and view modified…
KNVx Sep 5, 2024
92d60a9
[IMP] connector_woocommerce_wpml: included slug name on export mapper…
KNVx Sep 5, 2024
7b3cab8
[IMP] connector_woocommerce: included slug name on export mapper for …
KNVx Sep 5, 2024
20639fa
[IMP] connector_woocommerce: modified public category view to include…
KNVx Sep 5, 2024
03d0f6b
[IMP] connector_woocommerce_wpml: commented code in resync export. it…
KNVx Sep 5, 2024
0d3d830
[IMP] connector_woocommerce_wpml: commented code in _prepare_relation…
KNVx Sep 5, 2024
88396ff
[IMP] connector_woocommerce: removed resync export from product_produ…
KNVx Sep 5, 2024
986dc6b
[IMP] connector_woocommerce: resync export modified by changes on con…
KNVx Sep 5, 2024
d2ca1dd
[IMP] connector_woocommerce: created button to export attachments of …
KNVx Sep 5, 2024
a4744f2
[FIX] connector_woocommerce: included attachments from templates and …
KNVx Sep 5, 2024
292f93e
[IMP] connector_woocommerce: product public category export None on d…
KNVx Sep 5, 2024
6b9464c
[FIX] connector_woocommerce: incorrect format on code
KNVx Sep 5, 2024
e136f0d
[IMP] connector_woocommerce_wpml: improved description mapping for pr…
KNVx Sep 6, 2024
992f4da
[IMP] connector_woocommerce_wpml: included TODOS for next tasks
KNVx Sep 6, 2024
cc751b4
[IMP] website_sale_extra_fields: slug_name modified to be computed wi…
KNVx Sep 12, 2024
2a32222
[IMP] connector_woocommerce_wpml: message duplicated term slug name c…
KNVx Sep 12, 2024
0bae763
[FIX] connector_woocommerce: import partners duplicate partners
KNVx Sep 12, 2024
1847a2a
[IMP] connector_woocommerce_apg_nif: included hooks to separate NIF f…
KNVx Sep 12, 2024
0c4b96c
[REF+I18N] connector_wordpress: change backend credentials field name
FrankC013 Oct 16, 2024
3c8ee41
[FIX] connector_woocommerce_wpml: languages required
FrankC013 Oct 16, 2024
21ffb02
[FIX] connector_woocommerce: expected string or bytes-like object whe…
FrankC013 Oct 16, 2024
62a2074
[REF] connector_extension_wordpress: rename wordpres backend credentials
FrankC013 Oct 16, 2024
30e9112
[REF] connector_woocommerce: dont create / write records in adapter w…
FrankC013 Oct 16, 2024
a5f70fa
[FIX] connector_woocommerce_apg_nif: duplicated partners
FrankC013 Oct 16, 2024
d2de03c
[FIX] connector_woocommerce: fix duplicated parents partners and impr…
FrankC013 Oct 16, 2024
83ea74f
[FIX] connector_woocommerce: only export product variants that are de…
FrankC013 Oct 21, 2024
79d27fc
[FIX] connector_woocommerce: fix the export for product variants and …
FrankC013 Oct 21, 2024
8a5fb21
[FIX] connector_woocommerce: allow exporting a product that was previ…
FrankC013 Oct 22, 2024
c32998c
[I18N] connector_extension_woocommerce
FrankC013 Oct 22, 2024
464f574
[I18N] connector_extension_wordpress
FrankC013 Oct 22, 2024
416910c
[IMP] connector_woocommerce: create hook to product image attachments…
FrankC013 Oct 28, 2024
90689af
[IMP] connector_woocommerce: update the sale price if the backend dis…
FrankC013 Nov 4, 2024
83eceb7
[IMP] connector_woocommerce: generate the batch with a job
FrankC013 Nov 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
64 changes: 64 additions & 0 deletions connector_extension_woocommerce/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
===============================
Connector Extension Woocommerce
===============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f381547277a60fe3768f6861b4c213c845b21507225ce930457b473de3c08289
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-NuoBiT%2Fodoo--addons-lightgray.png?logo=github
:target: https://github.com/NuoBiT/odoo-addons/tree/14.0/connector_extension_woocommerce
:alt: NuoBiT/odoo-addons

|badge1| |badge2| |badge3|

This module extends the connector extension module to add support for Woocommerce

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/NuoBiT/odoo-addons/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/NuoBiT/odoo-addons/issues/new?body=module:%20connector_extension_woocommerce%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* NuoBiT Solutions
* SL

Contributors
~~~~~~~~~~~~

* `NuoBiT <https://www.nuobit.com>`__:

* Kilian Niubo <[email protected]>
* Eric Antones <[email protected]>

Maintainers
~~~~~~~~~~~

This module is part of the `NuoBiT/odoo-addons <https://github.com/NuoBiT/odoo-addons/tree/14.0/connector_extension_woocommerce>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions connector_extension_woocommerce/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import components
15 changes: 15 additions & 0 deletions connector_extension_woocommerce/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright NuoBiT Solutions - Kilian Niubo <[email protected]>
# Copyright NuoBiT Solutions - Eric Antones <[email protected]>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)

{
"name": "Connector Extension Woocommerce",
"summary": "This module extends the connector extension module "
"to add support for Woocommerce",
"version": "14.0.1.0.0",
"author": "NuoBiT Solutions, SL",
"license": "LGPL-3",
"category": "Connector",
"website": "https://github.com/nuobit/odoo-addons",
"depends": ["connector_extension"],
}
1 change: 1 addition & 0 deletions connector_extension_woocommerce/components/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import adapter
212 changes: 212 additions & 0 deletions connector_extension_woocommerce/components/adapter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
# Copyright NuoBiT Solutions - Eric Antones <[email protected]>
# Copyright NuoBiT Solutions - Kilian Niubo <[email protected]>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)

import json
import logging

from requests.exceptions import ConnectionError as RequestConnectionError

from odoo import _
from odoo.exceptions import ValidationError

from odoo.addons.component.core import AbstractComponent
from odoo.addons.connector.exception import RetryableJobError

from ...connector_extension.common.tools import trim_domain

_logger = logging.getLogger(__name__)


class ConnectorExtensionWooCommerceAdapterCRUD(AbstractComponent):
_name = "connector.extension.woocommerce.adapter.crud"
_inherit = "connector.extension.adapter.crud"

def _exec(self, op, resource, *args, **kwargs):
if kwargs.get("domain"):
kwargs["domain"] = trim_domain(kwargs["domain"])
func = getattr(self, "_exec_%s" % op)
return func(resource, *args, **kwargs)

def _manage_error_codes(
self, res_data, res, resource, raise_on_error=True, **kwargs
):
if not res.ok:
error_message = None
if res.status_code == 404:
if res_data.get("code") == "rest_no_route":
error_message = _(
"Error: '%s'. Probably the %s has been"
" removed from Woocommerce. "
"If it's the case, try to remove the binding of the %s."
% (res_data.get("message"), resource, self.model._name)
)
elif res_data.get("code") == "woocommerce_rest_term_invalid":
error_message = _(
"Error: '%s'. Probably the %s has been "
"removed from Woocommerce. "
"If it's the case, try to remove the binding of the %s."
% (res_data.get("message"), resource, self.model._name)
)
elif (
res_data.get("code")
== "woocommerce_rest_product_variation_invalid_parent"
):
error_message = _(
"Error: '%s'. Probably the product in %s "
"has been removed from Woocommerce. "
"If it's the case, try to remove the binding of the "
"woocommerce.product.template"
% (
res_data.get("message"),
resource,
)
)
elif res.status_code == 400:
if res_data.get("code") == "term_exists":
error_message = _(
"Error: '%s'. Probably repeated record already exists in Woocommerce.\n"
"Please, review the data in %s/%s and compare it with %s"
% (
res_data["message"],
resource,
res_data["res_data"]["resource_id"],
kwargs["data"],
)
)
elif (
res_data.get("code")
== "woocommerce_rest_product_variation_invalid_id"
):
error_message = _(
"Error: '%s'. Probably the %s has been removed from Woocommerce. "
"If it's the case, try to remove the binding of the %s."
% (res_data.get("message"), resource, self.model._name)
)
if not error_message:
error_message = _("Error: %s, Resource: %s" % (res_data, resource))
if raise_on_error:
raise ValidationError(error_message)
return error_message
return res_data

# TODO: remove this total items and use the res.headers instead
def _get_res_total_items(self, res):
headers = res.headers
total_items = headers.get("X-WP-Total") or 0
if total_items:
total_items = int(headers.get("X-WP-Total"))
return total_items

def _exec_wcapi_call(self, op, resource, *args, **kwargs):
func = getattr(self.wcapi, op)
try:
res = func(resource, *args, **kwargs)
res_data = res.json()
if "data" in res_data:
res_data["res_data"] = res_data.pop("data")
res_data = self._manage_error_codes(res_data, res, resource, **kwargs)
total_items = self._get_res_total_items(res)
result = {
"ok": res.ok,
"status_code": res.status_code,
"total_items": total_items,
"data": res_data,
}
except RequestConnectionError as e:
raise RetryableJobError(_("Error connecting to WooCommerce: %s") % e) from e
except json.decoder.JSONDecodeError as e:
raise ValidationError(
_(
"Error decoding json WooCommerce response: "
"%s\nArgs:%s\nKwargs:%s\n"
"URL:%s\nHeaders:%s\nMethod:%s\nBody:%s"
)
% (
e,
args,
kwargs,
res.url,
res.request.headers,
res.request.method,
res.text and res.text[:100] + " ...",
)
) from e
return result

def get_total_items(self, resource, domain=None):
filters_values = self._get_search_fields()
real_domain, common_domain = self._extract_domain_clauses(
domain, filters_values
)
params = self._domain_to_normalized_dict(real_domain)
params["per_page"] = 1
result = self._exec_wcapi_call("get", resource, params=params)
return result["total_items"]

def _get_search_fields(self):
return ["modified_after", "offset", "per_page", "page"]

def _exec_get(self, resource, *args, **kwargs):
if resource == "system_status":
return self._exec_wcapi_call("get", resource, *args, **kwargs)
# WooCommerce has the parameter next on the response headers
# to get the next page but we can't use it because if we use
# the offset, the next page will have the same items as the first page.
# It looks like a bug in WooCommerce API.
domain = []
if "domain" in kwargs:
domain = kwargs.pop("domain")
search_fields = self._get_search_fields()
real_domain, common_domain = self._extract_domain_clauses(domain, search_fields)
params = self._domain_to_normalized_dict(real_domain)
if "limit" in kwargs:
limit = kwargs.pop("limit")
else:
limit = self.get_total_items(resource, domain)
params["offset"] = (
kwargs.pop("offset") if "offset" in kwargs and "offset" not in params else 0
)
page_size = self.backend_record.page_size
params["per_page"] = page_size if page_size > 0 else 100
data = []
while len(data) < limit:
if page_size > limit - len(data):
params["per_page"] = limit - len(data)
res = self._exec_wcapi_call("get", resource, params=params, *args, **kwargs)
# WooCommerce returns a dict if the response is a single item
if not isinstance(res["data"], list):
res["data"] = [res["data"]]
data += res["data"]
params["offset"] += len(res["data"])
return self._filter(data, common_domain)

def _exec_post(self, resource, *args, **kwargs):
res = self._exec_wcapi_call(
"post",
resource,
*args,
**kwargs,
)
return res["data"]

def _exec_put(self, resource, *args, **kwargs):
return self._exec_wcapi_call("put", resource, *args, **kwargs)

def _exec_delete(self, resource, *args, **kwargs):
return self._exec_wcapi_call(
"delete",
resource,
*args,
**kwargs,
)

def _exec_options(self, resource, *args, **kwargs):
raise NotImplementedError()

def get_version(self):
system_status = self._exec("get", "system_status")
version = False
if system_status:
version = system_status["data"].get("environment").get("version")
return version
82 changes: 82 additions & 0 deletions connector_extension_woocommerce/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * connector_extension_woocommerce
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-22 12:51+0000\n"
"PO-Revision-Date: 2024-10-22 12:51+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: connector_extension_woocommerce
#: code:addons/connector_extension_woocommerce/components/adapter.py:0
#, python-format
msgid "Error connecting to WooCommerce: %s"
msgstr "Error al connectar amb WooCommerce: %s"

#. module: connector_extension_woocommerce
#: code:addons/connector_extension_woocommerce/components/adapter.py:0
#, python-format
msgid ""
"Error decoding json WooCommerce response: %s\n"
"Args:%s\n"
"Kwargs:%s\n"
"URL:%s\n"
"Headers:%s\n"
"Method:%s\n"
"Body:%s"
msgstr ""
"Error decodificant la resposta json de WooCommerce: %s\n"
"Args:%s\n"
"Kwargs:%s\n"
"URL:%s\n"
"Headers:%s\n"
"Method:%s\n"
"Body:%s"

#. module: connector_extension_woocommerce
#: code:addons/connector_extension_woocommerce/components/adapter.py:0
#, python-format
msgid "Error: %s, Resource: %s"
msgstr "Error: %s, Recurs: %s"

#. module: connector_extension_woocommerce
#: code:addons/connector_extension_woocommerce/components/adapter.py:0
#, python-format
msgid ""
"Error: '%s'. Probably repeated record already exists in Woocommerce.\n"
"Please, review the data in %s/%s and compare it with %s"
msgstr ""
"Error: '%s'. Probablement el registre repetit ja existeix a Woocommerce.\n"
"Si us plau, revisa les dades a %s/%s i compara-les amb %s"

#. module: connector_extension_woocommerce
#: code:addons/connector_extension_woocommerce/components/adapter.py:0
#: code:addons/connector_extension_woocommerce/components/adapter.py:0
#: code:addons/connector_extension_woocommerce/components/adapter.py:0
#, python-format
msgid ""
"Error: '%s'. Probably the %s has been removed from Woocommerce. If it's the "
"case, try to remove the binding of the %s."
msgstr ""
"Error: '%s'. Probablement el %s ha estat eliminat de Woocommerce. Si és el "
"cas, intenta eliminar la vinculació del %s."

#. module: connector_extension_woocommerce
#: code:addons/connector_extension_woocommerce/components/adapter.py:0
#, python-format
msgid ""
"Error: '%s'. Probably the product in %s has been removed from Woocommerce. "
"If it's the case, try to remove the binding of the "
"woocommerce.product.template"
msgstr ""
"Error: '%s'. Probablement el producte a %s ha estat eliminat de Woocommerce. "
"Si és el cas, intenta eliminar la vinculació del "
"woocommerce.product.template"
Loading
Loading