Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions connector_woocommerce_apg_nif/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=======================
WooCommerce Connector
=======================

* This module works with plugin APG NIF/CIF/NIE Field for WooCommerce.
* https://artprojectgroup.es/plugins-para-woocommerce/wc-apg-nifcifnie-field

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 smashing it by providing a detailed and welcomed feedback.

Credits
=======

Contributors
------------

* Kilian Niubo <kniubo@nuobit.com>




1 change: 1 addition & 0 deletions connector_woocommerce_apg_nif/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions connector_woocommerce_apg_nif/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright NuoBiT Solutions - Kilian Niubo <kniubo@nuobit.com>
# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo <dgallo@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

{
"name": "Connector WooCommerce APG NIF",
"version": "18.0.1.0.0",
"author": "NuoBiT Solutions SL",
"license": "AGPL-3",
"category": "Connector",
"website": "https://github.com/NuoBiT/odoo-addons",
"external_dependencies": {
"python": [
"woocommerce",
],
},
"depends": [
"connector_woocommerce",
],
}
2 changes: 2 additions & 0 deletions connector_woocommerce_apg_nif/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import res_partner
from . import sale_order
2 changes: 2 additions & 0 deletions connector_woocommerce_apg_nif/models/res_partner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import import_mapper
from . import res_partner
12 changes: 12 additions & 0 deletions connector_woocommerce_apg_nif/models/res_partner/import_mapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright NuoBiT Solutions - Kilian Niubo <kniubo@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo.addons.component.core import Component
from odoo.addons.connector.components.mapper import mapping


class WooCommerceResPartnerImportMapper(Component):
_inherit = "woocommerce.res.partner.import.mapper"

@mapping
def vat(self, record):
return {"vat": record.get("nif")}
23 changes: 23 additions & 0 deletions connector_woocommerce_apg_nif/models/res_partner/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright NuoBiT Solutions - Kilian Niubo <kniubo@nuobit.com>
# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo <dgallo@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import api, models


class Partner(models.Model):
_inherit = "res.partner"

def _get_hash_fields(self):
hash_fields = super()._get_hash_fields()
return hash_fields + ["vat"]

@api.depends("vat")
def _compute_address_hash(self):
return super()._compute_address_hash()

def _set_values_hash(self):
for rec in self:
values = super()._set_values_hash()
values.append(rec.vat or None)
return values
2 changes: 2 additions & 0 deletions connector_woocommerce_apg_nif/models/sale_order/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import adapter
from . import importer
29 changes: 29 additions & 0 deletions connector_woocommerce_apg_nif/models/sale_order/adapter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright NuoBiT Solutions - Kilian Niubo <kniubo@nuobit.com>
# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo <dgallo@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo.addons.component.core import Component


class WooCommerceSaleOrderAdapter(Component):
_inherit = "woocommerce.sale.order.adapter"

_apply_on = "woocommerce.sale.order"

def _get_hash_fields(self):
hash_fields = super()._get_hash_fields()
return hash_fields + ["nif"]

def _get_billing(self, value, hash_fields):
if value.get("billing"):
for item in value["meta_data"]:
if item["key"] == "_billing_nif":
value["billing"]["nif"] = item["value"]
return super()._get_billing(value, hash_fields)

def _get_shipping(self, value, hash_fields):
if value.get("shipping"):
for item in value["meta_data"]:
if item["key"] == "_shipping_nif":
value["shipping"]["nif"] = item["value"]
return super()._get_shipping(value, hash_fields)
29 changes: 29 additions & 0 deletions connector_woocommerce_apg_nif/models/sale_order/importer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright NuoBiT Solutions - Frank Cespedes <fcespedes@nuobit.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from odoo.osv import expression

from odoo.addons.component.core import Component


class WooCommerceBaseSaleOrderImporter(Component):
_inherit = "woocommerce.sale.order.record.direct.importer"

def _get_partner_parent_domain(self, dir_type, value):
domain = super()._get_partner_parent_domain(dir_type, value)
if value[dir_type].get("nif"):
domain = [d for d in domain if d[0] != "name"]
domain = expression.AND([domain, [("vat", "=", value[dir_type]["nif"])]])
else:
if (
dir_type == "shipping"
and value["shipping"]["name"] == value["billing"]["name"]
):
domain.append(("id", "=", value["billing"]["parent"]))
return domain

def _additional_partner_parent_fields(self, value, dir_type):
return {
**super()._additional_partner_parent_fields(value, dir_type),
"vat": value[dir_type].get("nif"),
}
3 changes: 3 additions & 0 deletions connector_woocommerce_apg_nif/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions connector_woocommerce_apg_nif/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [NuoBiT](https://www.nuobit.com):
- Kilian Niubo <kniubo@nuobit.com>
- Deniz Gallo <dgallo@nuobit.com>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# generated from manifests external_dependencies
woocommerce
6 changes: 6 additions & 0 deletions setup/connector_woocommerce_apg_nif/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
9 changes: 9 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Loading