From 60806de09ca076b3d49ad754058c41296ee42d8a Mon Sep 17 00:00:00 2001 From: KNVx Date: Thu, 8 Aug 2024 12:15:31 +0200 Subject: [PATCH 1/6] [ADD] connector_wordpress_wpml --- connector_wordpress_wpml/README.rst | 70 +++ connector_wordpress_wpml/__init__.py | 1 + connector_wordpress_wpml/__manifest__.py | 20 + .../migrations/14.0.0.1.1/pre-migration.py | 36 ++ .../migrations/14.0.0.1.2/pre-migration.py | 20 + connector_wordpress_wpml/models/__init__.py | 3 + .../models/backend/__init__.py | 1 + .../models/backend/backend.py | 24 + .../models/ir_attachment/__init__.py | 5 + .../models/ir_attachment/adapter.py | 26 ++ .../models/ir_attachment/binder.py | 52 +++ .../models/ir_attachment/binding.py | 37 ++ .../models/ir_attachment/export_mapper.py | 18 + .../models/ir_attachment/exporter.py | 25 + connector_wordpress_wpml/models/res_lang.py | 40 ++ .../readme/CONTRIBUTORS.rst | 3 + .../readme/DESCRIPTION.rst | 8 + .../static/description/icon.png | Bin 0 -> 6342 bytes .../static/description/index.html | 432 ++++++++++++++++++ .../views/ir_attachment_views.xml | 31 ++ .../views/res_lang_views.xml | 23 + .../views/wordpress_backend_view.xml | 22 + .../odoo/addons/connector_wordpress_wpml | 1 + setup/connector_wordpress_wpml/setup.py | 6 + 24 files changed, 904 insertions(+) create mode 100644 connector_wordpress_wpml/README.rst create mode 100644 connector_wordpress_wpml/__init__.py create mode 100644 connector_wordpress_wpml/__manifest__.py create mode 100644 connector_wordpress_wpml/migrations/14.0.0.1.1/pre-migration.py create mode 100644 connector_wordpress_wpml/migrations/14.0.0.1.2/pre-migration.py create mode 100644 connector_wordpress_wpml/models/__init__.py create mode 100644 connector_wordpress_wpml/models/backend/__init__.py create mode 100644 connector_wordpress_wpml/models/backend/backend.py create mode 100644 connector_wordpress_wpml/models/ir_attachment/__init__.py create mode 100644 connector_wordpress_wpml/models/ir_attachment/adapter.py create mode 100644 connector_wordpress_wpml/models/ir_attachment/binder.py create mode 100644 connector_wordpress_wpml/models/ir_attachment/binding.py create mode 100644 connector_wordpress_wpml/models/ir_attachment/export_mapper.py create mode 100644 connector_wordpress_wpml/models/ir_attachment/exporter.py create mode 100644 connector_wordpress_wpml/models/res_lang.py create mode 100644 connector_wordpress_wpml/readme/CONTRIBUTORS.rst create mode 100644 connector_wordpress_wpml/readme/DESCRIPTION.rst create mode 100644 connector_wordpress_wpml/static/description/icon.png create mode 100644 connector_wordpress_wpml/static/description/index.html create mode 100644 connector_wordpress_wpml/views/ir_attachment_views.xml create mode 100644 connector_wordpress_wpml/views/res_lang_views.xml create mode 100644 connector_wordpress_wpml/views/wordpress_backend_view.xml create mode 120000 setup/connector_wordpress_wpml/odoo/addons/connector_wordpress_wpml create mode 100644 setup/connector_wordpress_wpml/setup.py diff --git a/connector_wordpress_wpml/README.rst b/connector_wordpress_wpml/README.rst new file mode 100644 index 000000000..673aec07c --- /dev/null +++ b/connector_wordpress_wpml/README.rst @@ -0,0 +1,70 @@ +======================== +Connector WordPress WMPL +======================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:d23d756741cd2b3f004e61155d338ccb1a5c43949541285f54121e019b39c117 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-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_wordpress_wpml + :alt: NuoBiT/odoo-addons + +|badge1| |badge2| |badge3| + +* This module works with plugin WordPress Multi Language. +* https://wpml.org/ + +On WPML settings uncheck the options + * When uploading media to the Media library, make it available in all languages. + * Duplicate media attachments for translations. + +If we don't do this, the media files will be created once for each language, which it can be a problem for the capacity of the server. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* NuoBiT Solutions +* S.L. + +Contributors +~~~~~~~~~~~~ + +* `NuoBiT `__: + + * Kilian Niubo + +Maintainers +~~~~~~~~~~~ + +This module is part of the `NuoBiT/odoo-addons `_ project on GitHub. + +You are welcome to contribute. diff --git a/connector_wordpress_wpml/__init__.py b/connector_wordpress_wpml/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/connector_wordpress_wpml/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/connector_wordpress_wpml/__manifest__.py b/connector_wordpress_wpml/__manifest__.py new file mode 100644 index 000000000..5400d6362 --- /dev/null +++ b/connector_wordpress_wpml/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright NuoBiT Solutions - Kilian Niubo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + +{ + "name": "Connector WordPress WMPL", + "version": "14.0.0.1.3", + "author": "NuoBiT Solutions, S.L.", + "license": "AGPL-3", + "category": "Connector", + "website": "https://github.com/nuobit/odoo-addons", + "depends": [ + "connector_wordpress", + ], + "data": [ + "views/ir_attachment_views.xml", + "views/res_lang_views.xml", + "views/wordpress_backend_view.xml", + ], + "installable": True, +} diff --git a/connector_wordpress_wpml/migrations/14.0.0.1.1/pre-migration.py b/connector_wordpress_wpml/migrations/14.0.0.1.1/pre-migration.py new file mode 100644 index 000000000..44887fab6 --- /dev/null +++ b/connector_wordpress_wpml/migrations/14.0.0.1.1/pre-migration.py @@ -0,0 +1,36 @@ +# Copyright 2025 NuoBiT Solutions - Deniz Gallo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + +_column_renames = { + "res_lang_wordpress_backend_rel": [ + ("wordpress_backend_id", "backend_id"), + ("res_lang_id", "lang_id"), + ] +} + + +@openupgrade.migrate(use_env=True) +def migrate(env, version): + if not version: + return + openupgrade.rename_columns(env.cr, _column_renames) + + env.cr.execute( + """ + ALTER TABLE res_lang_wordpress_backend_rel + RENAME CONSTRAINT + res_lang_wordpress_backend_rel_wordpress_backend_id_fkey + TO res_lang_wordpress_backend_rel_backend_id_fkey; + """ + ) + + env.cr.execute( + """ + ALTER TABLE res_lang_wordpress_backend_rel + RENAME CONSTRAINT + res_lang_wordpress_backend_rel_res_lang_id_fkey + TO res_lang_wordpress_backend_rel_lang_id_fkey; + """ + ) diff --git a/connector_wordpress_wpml/migrations/14.0.0.1.2/pre-migration.py b/connector_wordpress_wpml/migrations/14.0.0.1.2/pre-migration.py new file mode 100644 index 000000000..f943c343f --- /dev/null +++ b/connector_wordpress_wpml/migrations/14.0.0.1.2/pre-migration.py @@ -0,0 +1,20 @@ +# Copyright 2025 NuoBiT Solutions - Deniz Gallo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + +_field_renames = [ + ( + "wordpress.backend", + "wordpress_backend", + "language_ids", + "lang_ids", + ) +] + + +@openupgrade.migrate(use_env=True) +def migrate(env, version): + if not version: + return + openupgrade.rename_fields(env, _field_renames) diff --git a/connector_wordpress_wpml/models/__init__.py b/connector_wordpress_wpml/models/__init__.py new file mode 100644 index 000000000..07f060dd6 --- /dev/null +++ b/connector_wordpress_wpml/models/__init__.py @@ -0,0 +1,3 @@ +from . import backend +from . import ir_attachment +from . import res_lang diff --git a/connector_wordpress_wpml/models/backend/__init__.py b/connector_wordpress_wpml/models/backend/__init__.py new file mode 100644 index 000000000..baacd255d --- /dev/null +++ b/connector_wordpress_wpml/models/backend/__init__.py @@ -0,0 +1 @@ +from . import backend diff --git a/connector_wordpress_wpml/models/backend/backend.py b/connector_wordpress_wpml/models/backend/backend.py new file mode 100644 index 000000000..1b51e8cc1 --- /dev/null +++ b/connector_wordpress_wpml/models/backend/backend.py @@ -0,0 +1,24 @@ +# Copyright NuoBiT Solutions - Kilian Niubo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import logging + +from odoo import _, api, models +from odoo.exceptions import ValidationError + +_logger = logging.getLogger(__name__) + + +class WordPressBackend(models.Model): + _inherit = "wordpress.backend" + + @api.constrains("lang_ids") + def check_lang_ids(self): + for rec in self: + for lang in rec.lang_ids: + if not lang.wordpress_wpml_lang_code: + raise ValidationError( + _( + "The language %s has no WPML code, please define " + "this code in language before using it." % lang.name + ) + ) diff --git a/connector_wordpress_wpml/models/ir_attachment/__init__.py b/connector_wordpress_wpml/models/ir_attachment/__init__.py new file mode 100644 index 000000000..b6ea9e5ec --- /dev/null +++ b/connector_wordpress_wpml/models/ir_attachment/__init__.py @@ -0,0 +1,5 @@ +from . import adapter +from . import binder +from . import binding +from . import export_mapper +from . import exporter diff --git a/connector_wordpress_wpml/models/ir_attachment/adapter.py b/connector_wordpress_wpml/models/ir_attachment/adapter.py new file mode 100644 index 000000000..d61ee9f1b --- /dev/null +++ b/connector_wordpress_wpml/models/ir_attachment/adapter.py @@ -0,0 +1,26 @@ +# Copyright NuoBiT Solutions - Kilian Niubo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + +from odoo.addons.component.core import Component + + +class WordPressIrAttachment(Component): + _inherit = "wordpress.ir.attachment.adapter" + + # def _get_search_fields(self): + # res = super()._get_search_fields() + # res.append("lang") + # return res + + def create(self, data): # pylint: disable=W8106 + lang = data.pop("lang") + res = super().create(data) + res["lang"] = lang + return res + + def write(self, external_id, data): # pylint: disable=W8106 + lang = data.pop("lang") + external_id_values = self.binder_for().id2dict(external_id, in_field=False) + res = self._exec("put", "media/%s" % external_id_values["id"], data=data) + res["lang"] = lang + return res diff --git a/connector_wordpress_wpml/models/ir_attachment/binder.py b/connector_wordpress_wpml/models/ir_attachment/binder.py new file mode 100644 index 000000000..f0315f9dd --- /dev/null +++ b/connector_wordpress_wpml/models/ir_attachment/binder.py @@ -0,0 +1,52 @@ +# Copyright NuoBiT Solutions - Kilian Niubo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + +from odoo.addons.component.core import Component + + +class WordPressIrAttachmentBinder(Component): + _inherit = "wordpress.ir.attachment.binder" + + @property + def external_alt_id(self): + return super().external_alt_id + ["lang"] + + # TODO: This funtions are the same as product wpml mixin + def get_binding_domain(self, record): + domain = super().get_binding_domain(record) + wp_wpml_code = self.env["res.lang"]._get_wpml_code_from_iso_code( + record._context.get("lang") + ) + if wp_wpml_code: + domain += [ + ( + "wordpress_lang", + "=", + wp_wpml_code, + ) + ] + return domain + + def _additional_external_binding_fields(self, external_data): + # TODO: this additional fields probably should be + # included in binding as m2o to res lang on upper binder + return { + **super()._additional_external_binding_fields(external_data), + "wordpress_lang": external_data.get("lang") or self.env.context.get("lang"), + } + + def _get_external_record_alt(self, relation, id_values): + res = super()._get_external_record_alt(relation, id_values) + if res: + relation_wp_lang = self.env["res.lang"]._get_wpml_code_from_iso_code( + relation.env.context.get("lang") + ) + if res.get("lang") != relation_wp_lang: + if res.get("translations") and res["translations"].get( + relation_wp_lang + ): + adapter = self.component(usage="backend.adapter") + res = adapter.read(res["translations"][relation_wp_lang]) + else: + return None + return res diff --git a/connector_wordpress_wpml/models/ir_attachment/binding.py b/connector_wordpress_wpml/models/ir_attachment/binding.py new file mode 100644 index 000000000..1f829da51 --- /dev/null +++ b/connector_wordpress_wpml/models/ir_attachment/binding.py @@ -0,0 +1,37 @@ +# Copyright NuoBiT Solutions - Kilian Niubo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + +from odoo import fields, models + + +class WordPressIrAttachment(models.Model): + _inherit = "wordpress.ir.attachment" + + wordpress_lang = fields.Char( + string="Language", + required=True, + ) + + _sql_constraints = [ + ( + "internal_uniq", + "unique(backend_id, wordpress_lang, odoo_id)", + "A binding already exists with the same Internal (Odoo) ID.", + ), + ( + "external_uniq", + "unique(backend_id, wordpress_ir_attachment," + "wordpress_irattachment, wordpress_lang)", + "A binding already exists with the same External (irAttachment) ID.", + ), + ] + + def _prepare_relation(self, relation, record): + super()._prepare_relation(relation, record) + context = relation.env.context.copy() + iso_lang = self.env["res.lang"]._get_iso_code_from_wpml_code( + record.wordpress_lang + ) + if iso_lang: + context.update({"lang": iso_lang, "resync_export": True}) + relation.env.context = context diff --git a/connector_wordpress_wpml/models/ir_attachment/export_mapper.py b/connector_wordpress_wpml/models/ir_attachment/export_mapper.py new file mode 100644 index 000000000..576d9615b --- /dev/null +++ b/connector_wordpress_wpml/models/ir_attachment/export_mapper.py @@ -0,0 +1,18 @@ +# Copyright NuoBiT Solutions - Kilian Niubo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + +from odoo.addons.component.core import Component +from odoo.addons.connector.components.mapper import changed_by, mapping + + +class WordPressIrAttachmentExportMapper(Component): + _inherit = "wordpress.ir.attachment.export.mapper" + + @changed_by("lang") + @mapping + def lang(self, record): + # TODO: unify this code. Probably do a function in res lang + lang = self.env["res.lang"]._get_wpml_code_from_iso_code( + record._context.get("lang") + ) + return {"lang": lang} diff --git a/connector_wordpress_wpml/models/ir_attachment/exporter.py b/connector_wordpress_wpml/models/ir_attachment/exporter.py new file mode 100644 index 000000000..a878600ad --- /dev/null +++ b/connector_wordpress_wpml/models/ir_attachment/exporter.py @@ -0,0 +1,25 @@ +# Copyright NuoBiT Solutions - Kilian Niubo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + +from odoo.addons.component.core import Component + + +class WordPressIrAttachmentExporter(Component): + _inherit = "wordpress.ir.attachment.record.direct.exporter" + + def run(self, relation, always=True, internal_fields=None): + res = [] + # langs_to_export = [] + # if relation.env.context.get("resync_export"): + # langs_to_export.append(relation.env.context.get("lang")) + # else: + langs_to_export = self.backend_record.lang_ids.mapped("code") + + for lang in langs_to_export: + result = super().run( + relation.with_context(lang=lang), + always=always, + internal_fields=internal_fields, + ) + res.append(result) + return res diff --git a/connector_wordpress_wpml/models/res_lang.py b/connector_wordpress_wpml/models/res_lang.py new file mode 100644 index 000000000..81fba4caf --- /dev/null +++ b/connector_wordpress_wpml/models/res_lang.py @@ -0,0 +1,40 @@ +# Copyright NuoBiT Solutions - Kilian Niubo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import logging + +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError + +_logger = logging.getLogger(__name__) + + +class Lang(models.Model): + _inherit = "res.lang" + + wordpress_wpml_lang_code = fields.Char() + + _sql_constraints = [ + ( + "wordpress_wpml_lang_code_uniq", + "unique(wordpress_wpml_lang_code)", + "The WPML lang code must be unique !", + ), + ] + + @api.model + def _get_wpml_code_from_iso_code(self, code): + lang = self.env["res.lang"].search([("code", "=", code)]) + if not lang: + raise ValidationError(_("Language not found with code %s") % code) + if not lang.wordpress_wpml_lang_code: + raise ValidationError(_("WPML code not found for lang: %s") % lang) + return lang.wordpress_wpml_lang_code + + @api.model + def _get_iso_code_from_wpml_code(self, wpml_code): + lang = self.env["res.lang"].search( + [("wordpress_wpml_lang_code", "=", wpml_code)] + ) + if not lang: + raise ValidationError(_("Language not found with wpml code %s") % wpml_code) + return lang.iso_code diff --git a/connector_wordpress_wpml/readme/CONTRIBUTORS.rst b/connector_wordpress_wpml/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..d018d7d8f --- /dev/null +++ b/connector_wordpress_wpml/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `NuoBiT `__: + + * Kilian Niubo diff --git a/connector_wordpress_wpml/readme/DESCRIPTION.rst b/connector_wordpress_wpml/readme/DESCRIPTION.rst new file mode 100644 index 000000000..0c37db6a1 --- /dev/null +++ b/connector_wordpress_wpml/readme/DESCRIPTION.rst @@ -0,0 +1,8 @@ +* This module works with plugin WordPress Multi Language. +* https://wpml.org/ + +On WPML settings uncheck the options + * When uploading media to the Media library, make it available in all languages. + * Duplicate media attachments for translations. + +If we don't do this, the media files will be created once for each language, which it can be a problem for the capacity of the server. diff --git a/connector_wordpress_wpml/static/description/icon.png b/connector_wordpress_wpml/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1cd641e792c30455187ca30940bc0f329ce8bbb0 GIT binary patch literal 6342 zcmd^^hf`C}*TzHWpfm-MZa|7OjYtjE(4`3pP0Eid3J8V{0s)mKJ<q zp^9|rp$mb~2}po9-@oIXJG(oxcjoS%d!O@s&d!Z9HP*e##KQyt0IurmK_64bp8pyH z9i^|ds>-JfbWVo4P{8GX*QeIfbjl2)kDfIG0ALvZuTgp2ZfK=U();NfY11z-vM>r= zo6RyI007+P`cO@apy}VqnaiVCLL`CEUGVGYE&5WpdhhbZv%|*-Y|2t(4~Cq|y`-Nmm-W zxaTf4+R69rVU1b%qjm?yu*PFgHFYd#J82-D8cpXqO&omwG2*Hd6ZIUiK@+ zNCo8Lg{1^vn^0ZQgz*~*ZR3wsULxnnSBN%7p()3EYs>sX9In)T{*nJ2q*qxXPNhFk z=z=+?4VOOdAF!ZYAVisYzF29g?udLQJtx@=HoAK_Kjx;4SO7>H_v*McB7(}RHMa> z+PNao{Hw&Mjo0P}CBR&l(k@iIeRI@PRH6R9^lR3e?TL?ZHra#GHvKmkeVBHG8nv4{ zz$nHGR7`D$ae@TrcXCSA=$~Yvp@J|bKul>6s-`yT7>JaM5?KcltZ)(ilt^74fqLA{ z1k!bKw(GMV*AOgI*glG_($h!cZgArkEAa1SkSG`0yF8JLWTq^J->2CRaqKH1ZSQt7 z29|+OBS3Rj91K1XL~_9&zn1p z)2Ez)&{9Of1X#b+mpgJ`{gurrlYqKrwrWXTOH{M%kEUhcgSp1J2FK4FF`JS|NfaAA6)?-&1}B`@lI2~kKWK) zhQ|}GQ$j(rNS}9?Yu9}MzWxz*HMwR=u8$RYY6sr2pu3x5Yx*P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static/description/index.html b/connector_wordpress_wpml/static/description/index.html new file mode 100644 index 000000000..049937116 --- /dev/null +++ b/connector_wordpress_wpml/static/description/index.html @@ -0,0 +1,432 @@ + + + + + +Connector WordPress WMPL + + + +
+

Connector WordPress WMPL

+ + +

Beta License: AGPL-3 NuoBiT/odoo-addons

+ +
+
On WPML settings uncheck the options
+
    +
  • When uploading media to the Media library, make it available in all languages.
  • +
  • Duplicate media attachments for translations.
  • +
+
+
+

If we don’t do this, the media files will be created once for each language, which it can be a problem for the capacity of the server.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • NuoBiT Solutions
  • +
  • S.L.
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the NuoBiT/odoo-addons project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/connector_wordpress_wpml/views/ir_attachment_views.xml b/connector_wordpress_wpml/views/ir_attachment_views.xml new file mode 100644 index 000000000..c1d29c029 --- /dev/null +++ b/connector_wordpress_wpml/views/ir_attachment_views.xml @@ -0,0 +1,31 @@ + + + + + wordpress.ir.attachment.view.form + wordpress.ir.attachment + + + + + + + + + wordpress.ir.attachment.view.tree + wordpress.ir.attachment + + + + + + + + diff --git a/connector_wordpress_wpml/views/res_lang_views.xml b/connector_wordpress_wpml/views/res_lang_views.xml new file mode 100644 index 000000000..129fad801 --- /dev/null +++ b/connector_wordpress_wpml/views/res_lang_views.xml @@ -0,0 +1,23 @@ + + + + res.lang.tree + res.lang + + + + + + + + + res.lang.form + res.lang + + + + + + + + diff --git a/connector_wordpress_wpml/views/wordpress_backend_view.xml b/connector_wordpress_wpml/views/wordpress_backend_view.xml new file mode 100644 index 000000000..2187dd67b --- /dev/null +++ b/connector_wordpress_wpml/views/wordpress_backend_view.xml @@ -0,0 +1,22 @@ + + + + + wordpress.backend.form + wordpress.backend + + + + + + + + diff --git a/setup/connector_wordpress_wpml/odoo/addons/connector_wordpress_wpml b/setup/connector_wordpress_wpml/odoo/addons/connector_wordpress_wpml new file mode 120000 index 000000000..295c048a2 --- /dev/null +++ b/setup/connector_wordpress_wpml/odoo/addons/connector_wordpress_wpml @@ -0,0 +1 @@ +../../../../connector_wordpress_wpml \ No newline at end of file diff --git a/setup/connector_wordpress_wpml/setup.py b/setup/connector_wordpress_wpml/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/connector_wordpress_wpml/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From 943fb223dd17c45726b1866268d9986555e33fd2 Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Tue, 18 Nov 2025 12:38:22 +0100 Subject: [PATCH 2/6] [REF+FIX] connector_wordpress_wpml: wrong sql constraint field --- connector_wordpress_wpml/models/ir_attachment/binding.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/connector_wordpress_wpml/models/ir_attachment/binding.py b/connector_wordpress_wpml/models/ir_attachment/binding.py index 1f829da51..903f3c6d3 100644 --- a/connector_wordpress_wpml/models/ir_attachment/binding.py +++ b/connector_wordpress_wpml/models/ir_attachment/binding.py @@ -12,17 +12,18 @@ class WordPressIrAttachment(models.Model): required=True, ) + # we overwrite the db constraints, so they must have exactly the same name + # as the parent inherited _sql_constraints = [ ( "internal_uniq", "unique(backend_id, wordpress_lang, odoo_id)", - "A binding already exists with the same Internal (Odoo) ID.", + "A binding already exists with the same Internal ID (odoo_id)", ), ( "external_uniq", - "unique(backend_id, wordpress_ir_attachment," - "wordpress_irattachment, wordpress_lang)", - "A binding already exists with the same External (irAttachment) ID.", + "unique(backend_id, wordpress_lang, wordpress_idattachment)", + "A binding already exists with the same External ID (idAttachment)", ), ] From 9e74ce347b04e99cc5eab52fc2a2125289242175 Mon Sep 17 00:00:00 2001 From: Eric Antones Date: Tue, 2 Dec 2025 13:22:58 +0100 Subject: [PATCH 3/6] [IMP+FIX+REF] connector_wordpress_wpml --- connector_wordpress_wpml/models/ir_attachment/binder.py | 4 ++-- connector_wordpress_wpml/models/ir_attachment/binding.py | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/connector_wordpress_wpml/models/ir_attachment/binder.py b/connector_wordpress_wpml/models/ir_attachment/binder.py index f0315f9dd..b68a8ad87 100644 --- a/connector_wordpress_wpml/models/ir_attachment/binder.py +++ b/connector_wordpress_wpml/models/ir_attachment/binder.py @@ -27,11 +27,11 @@ def get_binding_domain(self, record): ] return domain - def _additional_external_binding_fields(self, external_data): + def _additional_external_binding_fields(self, external_data, relation): # TODO: this additional fields probably should be # included in binding as m2o to res lang on upper binder return { - **super()._additional_external_binding_fields(external_data), + **super()._additional_external_binding_fields(external_data, relation), "wordpress_lang": external_data.get("lang") or self.env.context.get("lang"), } diff --git a/connector_wordpress_wpml/models/ir_attachment/binding.py b/connector_wordpress_wpml/models/ir_attachment/binding.py index 903f3c6d3..fc059c6c8 100644 --- a/connector_wordpress_wpml/models/ir_attachment/binding.py +++ b/connector_wordpress_wpml/models/ir_attachment/binding.py @@ -17,14 +17,9 @@ class WordPressIrAttachment(models.Model): _sql_constraints = [ ( "internal_uniq", - "unique(backend_id, wordpress_lang, odoo_id)", + "unique(backend_id, odoo_id, wordpress_lang)", "A binding already exists with the same Internal ID (odoo_id)", - ), - ( - "external_uniq", - "unique(backend_id, wordpress_lang, wordpress_idattachment)", - "A binding already exists with the same External ID (idAttachment)", - ), + ) ] def _prepare_relation(self, relation, record): From 4c57cec78a08f5b957c59dea20e808e65ef4188b Mon Sep 17 00:00:00 2001 From: ??? Date: Mon, 30 Mar 2026 13:29:42 +0200 Subject: [PATCH 4/6] [IMP] connector_wordpress_wpml: pre-commit auto fixes --- connector_wordpress_wpml/README.rst | 29 ++++++++++--------- connector_wordpress_wpml/__manifest__.py | 2 +- connector_wordpress_wpml/pyproject.toml | 3 ++ .../readme/CONTRIBUTORS.md | 2 ++ .../readme/CONTRIBUTORS.rst | 3 -- .../readme/DESCRIPTION.md | 10 +++++++ .../readme/DESCRIPTION.rst | 8 ----- .../static/description/index.html | 19 ++++++------ .../views/ir_attachment_views.xml | 2 +- 9 files changed, 42 insertions(+), 36 deletions(-) create mode 100644 connector_wordpress_wpml/pyproject.toml create mode 100644 connector_wordpress_wpml/readme/CONTRIBUTORS.md delete mode 100644 connector_wordpress_wpml/readme/CONTRIBUTORS.rst create mode 100644 connector_wordpress_wpml/readme/DESCRIPTION.md delete mode 100644 connector_wordpress_wpml/readme/DESCRIPTION.rst diff --git a/connector_wordpress_wpml/README.rst b/connector_wordpress_wpml/README.rst index 673aec07c..d7c177738 100644 --- a/connector_wordpress_wpml/README.rst +++ b/connector_wordpress_wpml/README.rst @@ -17,19 +17,22 @@ Connector WordPress WMPL :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-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_wordpress_wpml + :target: https://github.com/NuoBiT/odoo-addons/tree/18.0/connector_wordpress_wpml :alt: NuoBiT/odoo-addons |badge1| |badge2| |badge3| -* This module works with plugin WordPress Multi Language. -* https://wpml.org/ +- This module works with plugin WordPress Multi Language. +- https://wpml.org/ On WPML settings uncheck the options - * When uploading media to the Media library, make it available in all languages. - * Duplicate media attachments for translations. -If we don't do this, the media files will be created once for each language, which it can be a problem for the capacity of the server. +- When uploading media to the Media library, make it available in all + languages. +- Duplicate media attachments for translations. + +If we don't do this, the media files will be created once for each +language, which it can be a problem for the capacity of the server. **Table of contents** @@ -42,7 +45,7 @@ Bug Tracker Bugs are tracked on `GitHub 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -50,21 +53,21 @@ Credits ======= Authors -~~~~~~~ +------- * NuoBiT Solutions * S.L. Contributors -~~~~~~~~~~~~ +------------ -* `NuoBiT `__: +- `NuoBiT `__: - * Kilian Niubo + - Kilian Niubo Maintainers -~~~~~~~~~~~ +----------- -This module is part of the `NuoBiT/odoo-addons `_ project on GitHub. +This module is part of the `NuoBiT/odoo-addons `_ project on GitHub. You are welcome to contribute. diff --git a/connector_wordpress_wpml/__manifest__.py b/connector_wordpress_wpml/__manifest__.py index 5400d6362..0ed820bbe 100644 --- a/connector_wordpress_wpml/__manifest__.py +++ b/connector_wordpress_wpml/__manifest__.py @@ -7,7 +7,7 @@ "author": "NuoBiT Solutions, S.L.", "license": "AGPL-3", "category": "Connector", - "website": "https://github.com/nuobit/odoo-addons", + "website": "https://github.com/NuoBiT/odoo-addons", "depends": [ "connector_wordpress", ], diff --git a/connector_wordpress_wpml/pyproject.toml b/connector_wordpress_wpml/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/connector_wordpress_wpml/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/connector_wordpress_wpml/readme/CONTRIBUTORS.md b/connector_wordpress_wpml/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..827f27baa --- /dev/null +++ b/connector_wordpress_wpml/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [NuoBiT](https://www.nuobit.com): + - Kilian Niubo \ diff --git a/connector_wordpress_wpml/readme/CONTRIBUTORS.rst b/connector_wordpress_wpml/readme/CONTRIBUTORS.rst deleted file mode 100644 index d018d7d8f..000000000 --- a/connector_wordpress_wpml/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,3 +0,0 @@ -* `NuoBiT `__: - - * Kilian Niubo diff --git a/connector_wordpress_wpml/readme/DESCRIPTION.md b/connector_wordpress_wpml/readme/DESCRIPTION.md new file mode 100644 index 000000000..440455250 --- /dev/null +++ b/connector_wordpress_wpml/readme/DESCRIPTION.md @@ -0,0 +1,10 @@ +- This module works with plugin WordPress Multi Language. +- + +On WPML settings uncheck the options +- When uploading media to the Media library, make it available in all + languages. +- Duplicate media attachments for translations. + +If we don't do this, the media files will be created once for each +language, which it can be a problem for the capacity of the server. diff --git a/connector_wordpress_wpml/readme/DESCRIPTION.rst b/connector_wordpress_wpml/readme/DESCRIPTION.rst deleted file mode 100644 index 0c37db6a1..000000000 --- a/connector_wordpress_wpml/readme/DESCRIPTION.rst +++ /dev/null @@ -1,8 +0,0 @@ -* This module works with plugin WordPress Multi Language. -* https://wpml.org/ - -On WPML settings uncheck the options - * When uploading media to the Media library, make it available in all languages. - * Duplicate media attachments for translations. - -If we don't do this, the media files will be created once for each language, which it can be a problem for the capacity of the server. diff --git a/connector_wordpress_wpml/static/description/index.html b/connector_wordpress_wpml/static/description/index.html index 049937116..d3ab38d0e 100644 --- a/connector_wordpress_wpml/static/description/index.html +++ b/connector_wordpress_wpml/static/description/index.html @@ -369,20 +369,19 @@

Connector WordPress WMPL

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:d23d756741cd2b3f004e61155d338ccb1a5c43949541285f54121e019b39c117 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 NuoBiT/odoo-addons

+

Beta License: AGPL-3 NuoBiT/odoo-addons

-
-
On WPML settings uncheck the options
-
    -
  • When uploading media to the Media library, make it available in all languages.
  • +

    On WPML settings uncheck the options

    +
      +
    • When uploading media to the Media library, make it available in all +languages.
    • Duplicate media attachments for translations.
    -
-
-

If we don’t do this, the media files will be created once for each language, which it can be a problem for the capacity of the server.

+

If we don’t do this, the media files will be created once for each +language, which it can be a problem for the capacity of the server.

Table of contents

    @@ -400,7 +399,7 @@

    Bug Tracker

    Bugs are tracked on GitHub 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.

    +feedback.

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

@@ -423,7 +422,7 @@

Contributors

Maintainers

-

This module is part of the NuoBiT/odoo-addons project on GitHub.

+

This module is part of the NuoBiT/odoo-addons project on GitHub.

You are welcome to contribute.

diff --git a/connector_wordpress_wpml/views/ir_attachment_views.xml b/connector_wordpress_wpml/views/ir_attachment_views.xml index c1d29c029..954b36788 100644 --- a/connector_wordpress_wpml/views/ir_attachment_views.xml +++ b/connector_wordpress_wpml/views/ir_attachment_views.xml @@ -15,7 +15,7 @@ - + wordpress.ir.attachment.view.tree wordpress.ir.attachment Date: Wed, 8 Apr 2026 12:35:21 +0200 Subject: [PATCH 5/6] [MIG] connector_wordpress_wpml: Migration to 18.0 --- connector_wordpress_wpml/README.rst | 6 ++-- connector_wordpress_wpml/__manifest__.py | 6 ++-- .../migrations/14.0.0.1.1/pre-migration.py | 36 ------------------- .../migrations/14.0.0.1.2/pre-migration.py | 20 ----------- .../models/backend/backend.py | 6 ++-- .../models/ir_attachment/adapter.py | 3 +- .../models/ir_attachment/binding.py | 3 +- .../readme/CONTRIBUTORS.md | 3 +- .../static/description/index.html | 6 ++-- .../views/ir_attachment_views.xml | 3 +- .../views/res_lang_views.xml | 2 +- .../views/wordpress_backend_view.xml | 2 +- 12 files changed, 23 insertions(+), 73 deletions(-) delete mode 100644 connector_wordpress_wpml/migrations/14.0.0.1.1/pre-migration.py delete mode 100644 connector_wordpress_wpml/migrations/14.0.0.1.2/pre-migration.py diff --git a/connector_wordpress_wpml/README.rst b/connector_wordpress_wpml/README.rst index d7c177738..4c7f698a4 100644 --- a/connector_wordpress_wpml/README.rst +++ b/connector_wordpress_wpml/README.rst @@ -55,15 +55,15 @@ Credits Authors ------- -* NuoBiT Solutions -* S.L. +* NuoBiT Solutions SL Contributors ------------ - `NuoBiT `__: - - Kilian Niubo + - Kilian Niubo kniubo@nuobit.com + - Deniz Gallo dgallo@nuobit.com Maintainers ----------- diff --git a/connector_wordpress_wpml/__manifest__.py b/connector_wordpress_wpml/__manifest__.py index 0ed820bbe..b670a211c 100644 --- a/connector_wordpress_wpml/__manifest__.py +++ b/connector_wordpress_wpml/__manifest__.py @@ -1,10 +1,11 @@ # Copyright NuoBiT Solutions - Kilian Niubo +# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) { "name": "Connector WordPress WMPL", - "version": "14.0.0.1.3", - "author": "NuoBiT Solutions, S.L.", + "version": "18.0.1.0.0", + "author": "NuoBiT Solutions SL", "license": "AGPL-3", "category": "Connector", "website": "https://github.com/NuoBiT/odoo-addons", @@ -16,5 +17,4 @@ "views/res_lang_views.xml", "views/wordpress_backend_view.xml", ], - "installable": True, } diff --git a/connector_wordpress_wpml/migrations/14.0.0.1.1/pre-migration.py b/connector_wordpress_wpml/migrations/14.0.0.1.1/pre-migration.py deleted file mode 100644 index 44887fab6..000000000 --- a/connector_wordpress_wpml/migrations/14.0.0.1.1/pre-migration.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2025 NuoBiT Solutions - Deniz Gallo -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from openupgradelib import openupgrade - -_column_renames = { - "res_lang_wordpress_backend_rel": [ - ("wordpress_backend_id", "backend_id"), - ("res_lang_id", "lang_id"), - ] -} - - -@openupgrade.migrate(use_env=True) -def migrate(env, version): - if not version: - return - openupgrade.rename_columns(env.cr, _column_renames) - - env.cr.execute( - """ - ALTER TABLE res_lang_wordpress_backend_rel - RENAME CONSTRAINT - res_lang_wordpress_backend_rel_wordpress_backend_id_fkey - TO res_lang_wordpress_backend_rel_backend_id_fkey; - """ - ) - - env.cr.execute( - """ - ALTER TABLE res_lang_wordpress_backend_rel - RENAME CONSTRAINT - res_lang_wordpress_backend_rel_res_lang_id_fkey - TO res_lang_wordpress_backend_rel_lang_id_fkey; - """ - ) diff --git a/connector_wordpress_wpml/migrations/14.0.0.1.2/pre-migration.py b/connector_wordpress_wpml/migrations/14.0.0.1.2/pre-migration.py deleted file mode 100644 index f943c343f..000000000 --- a/connector_wordpress_wpml/migrations/14.0.0.1.2/pre-migration.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2025 NuoBiT Solutions - Deniz Gallo -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from openupgradelib import openupgrade - -_field_renames = [ - ( - "wordpress.backend", - "wordpress_backend", - "language_ids", - "lang_ids", - ) -] - - -@openupgrade.migrate(use_env=True) -def migrate(env, version): - if not version: - return - openupgrade.rename_fields(env, _field_renames) diff --git a/connector_wordpress_wpml/models/backend/backend.py b/connector_wordpress_wpml/models/backend/backend.py index 1b51e8cc1..ab47b8739 100644 --- a/connector_wordpress_wpml/models/backend/backend.py +++ b/connector_wordpress_wpml/models/backend/backend.py @@ -1,4 +1,5 @@ # Copyright NuoBiT Solutions - Kilian Niubo +# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import logging @@ -18,7 +19,8 @@ def check_lang_ids(self): if not lang.wordpress_wpml_lang_code: raise ValidationError( _( - "The language %s has no WPML code, please define " - "this code in language before using it." % lang.name + "The language %(lang)s has no WPML code, please define " + "this code in language before using it." ) + % {"lang": lang.name} ) diff --git a/connector_wordpress_wpml/models/ir_attachment/adapter.py b/connector_wordpress_wpml/models/ir_attachment/adapter.py index d61ee9f1b..4c408d0c1 100644 --- a/connector_wordpress_wpml/models/ir_attachment/adapter.py +++ b/connector_wordpress_wpml/models/ir_attachment/adapter.py @@ -1,4 +1,5 @@ # Copyright NuoBiT Solutions - Kilian Niubo +# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) from odoo.addons.component.core import Component @@ -21,6 +22,6 @@ def create(self, data): # pylint: disable=W8106 def write(self, external_id, data): # pylint: disable=W8106 lang = data.pop("lang") external_id_values = self.binder_for().id2dict(external_id, in_field=False) - res = self._exec("put", "media/%s" % external_id_values["id"], data=data) + res = self._exec("put", f"media/{external_id_values['id']}", data=data) res["lang"] = lang return res diff --git a/connector_wordpress_wpml/models/ir_attachment/binding.py b/connector_wordpress_wpml/models/ir_attachment/binding.py index fc059c6c8..0851b82ee 100644 --- a/connector_wordpress_wpml/models/ir_attachment/binding.py +++ b/connector_wordpress_wpml/models/ir_attachment/binding.py @@ -23,7 +23,7 @@ class WordPressIrAttachment(models.Model): ] def _prepare_relation(self, relation, record): - super()._prepare_relation(relation, record) + res = super()._prepare_relation(relation, record) context = relation.env.context.copy() iso_lang = self.env["res.lang"]._get_iso_code_from_wpml_code( record.wordpress_lang @@ -31,3 +31,4 @@ def _prepare_relation(self, relation, record): if iso_lang: context.update({"lang": iso_lang, "resync_export": True}) relation.env.context = context + return res diff --git a/connector_wordpress_wpml/readme/CONTRIBUTORS.md b/connector_wordpress_wpml/readme/CONTRIBUTORS.md index 827f27baa..5d535bfca 100644 --- a/connector_wordpress_wpml/readme/CONTRIBUTORS.md +++ b/connector_wordpress_wpml/readme/CONTRIBUTORS.md @@ -1,2 +1,3 @@ - [NuoBiT](https://www.nuobit.com): - - Kilian Niubo \ + - Kilian Niubo + - Deniz Gallo diff --git a/connector_wordpress_wpml/static/description/index.html b/connector_wordpress_wpml/static/description/index.html index d3ab38d0e..1d4337107 100644 --- a/connector_wordpress_wpml/static/description/index.html +++ b/connector_wordpress_wpml/static/description/index.html @@ -407,15 +407,15 @@

Credits

Authors

    -
  • NuoBiT Solutions
  • -
  • S.L.
  • +
  • NuoBiT Solutions SL

Contributors

diff --git a/connector_wordpress_wpml/views/ir_attachment_views.xml b/connector_wordpress_wpml/views/ir_attachment_views.xml index 954b36788..cb4393a0f 100644 --- a/connector_wordpress_wpml/views/ir_attachment_views.xml +++ b/connector_wordpress_wpml/views/ir_attachment_views.xml @@ -1,5 +1,6 @@ @@ -16,7 +17,7 @@ - wordpress.ir.attachment.view.tree + wordpress.ir.attachment.view.list wordpress.ir.attachment - res.lang.tree + res.lang.list res.lang diff --git a/connector_wordpress_wpml/views/wordpress_backend_view.xml b/connector_wordpress_wpml/views/wordpress_backend_view.xml index 2187dd67b..7bf97fe3d 100644 --- a/connector_wordpress_wpml/views/wordpress_backend_view.xml +++ b/connector_wordpress_wpml/views/wordpress_backend_view.xml @@ -14,7 +14,7 @@ From a54cac7e8f8e7c93306091bc193d1f81e92e474a Mon Sep 17 00:00:00 2001 From: ??? Date: Wed, 8 Apr 2026 12:37:17 +0200 Subject: [PATCH 6/6] [DO NOT MERGE] test-requirements.txt --- test-requirements.txt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test-requirements.txt diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..f6e0c2e2c --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,9 @@ +odoo-addon-website_sale_stock_variant@git+https://github.com/nuobit/odoo-addons.git@refs/pull/825/head#subdirectory=website_sale_stock_variant +odoo-addon-website_sale_extra_fields@git+https://github.com/nuobit/odoo-addons.git@refs/pull/826/head#subdirectory=website_sale_extra_fields +odoo-addon-connector_wordpress@git+https://github.com/nuobit/odoo-addons.git@refs/pull/876/head#subdirectory=connector_wordpress +odoo-addon-connector_extension_woocommerce@git+https://github.com/nuobit/odoo-addons.git@refs/pull/875/head#subdirectory=connector_extension_woocommerce +odoo-addon-tools_mimetypes_extension@git+https://github.com/nuobit/odoo-addons.git@refs/pull/878/head#subdirectory=tools_mimetypes_extension +odoo-addon-website_sale_variant@git+https://github.com/nuobit/odoo-addons.git@refs/pull/824/head#subdirectory=website_sale_variant +odoo-addon-website_sale_product_document@git+https://github.com/nuobit/odoo-addons.git@refs/pull/827/head#subdirectory=website_sale_product_document +odoo-addon-connector_extension_wordpress@git+https://github.com/nuobit/odoo-addons.git@refs/pull/877/head#subdirectory=connector_extension_wordpress +odoo-addon-connector_woocommerce@git+https://github.com/nuobit/odoo-addons.git@refs/pull/874/head#subdirectory=connector_woocommerce