Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
fc56e04
Add connector_importer_product
mmequignon Mar 7, 2022
6f70f3a
connector_importer_product: not installable
simahawk Nov 7, 2022
4a987b4
connector_importer_product: migrate to v15
simahawk Apr 1, 2022
b12d5a4
connector_importer_product: mapper fixes
simahawk Apr 1, 2022
07538cf
c_importer_product: split product importer files
simahawk Apr 5, 2022
2c81dec
c_importer_product: make importer and mapper smarter
simahawk Apr 6, 2022
4b7c430
c_importer_product: improve attr value FIXME
simahawk Apr 6, 2022
f8a8998
c_importer_product: improve product import
simahawk Apr 13, 2022
00a35cc
c_importer_product: improve supplierinfo import
simahawk Apr 13, 2022
a79c400
c_importer_product: fix tmpl attrib values
simahawk Jul 8, 2022
0a157a7
c_importer_product: add default import.type
simahawk Nov 7, 2022
8cca618
c_importer_product: add only-in-one type
simahawk Nov 7, 2022
6bc8956
c_importer_product: add tests common class
simahawk Nov 3, 2022
e3ac96f
c_importer_product: add tests for prod category
simahawk Nov 3, 2022
173a547
c_importer_product: drop category specific importer
simahawk Nov 7, 2022
e85300a
c_importer_product: silent tests logger
simahawk Nov 4, 2022
ab87801
c_importer_product: drop custom prod attribute importer
simahawk Nov 4, 2022
2b015a6
c_importer_product: drop custom prod attribute value importer
simahawk Nov 4, 2022
39379c3
c_importer_product: drop custom prod pkg importer
simahawk Nov 7, 2022
40270f7
connector_importer_product: skip barcode when empty
simahawk Nov 7, 2022
acb6878
connector_importer_product: improve attr value lookup
simahawk Nov 7, 2022
7c978d2
connector_importer_product: drop dead code
simahawk Nov 7, 2022
36d571d
connector_importer_product: improve product import test cov
simahawk Nov 7, 2022
17ad123
connector_importer_product: adapt default import.type conf
simahawk Nov 8, 2022
fce2921
connector_importer_product: fix author name
simahawk Nov 8, 2022
56c9c00
connector_importer_product: make not installable
simahawk Mar 2, 2023
15f73db
connector_importer_product: fix supplierinfo default conf
simahawk May 8, 2023
3a8253d
connector_importer_product: add ROADMAP
simahawk May 8, 2023
620169e
connector_importer_product: exclude blacklisted columns
simahawk May 10, 2023
7d6c2d2
connector_importer_product: create xid for tmpl when needed
simahawk May 10, 2023
10be9b4
c_importer_product: supplierinfo fix tmpl lookup via xid
simahawk May 10, 2023
ea6192e
connector_importer_product: add comment for pkg import
simahawk May 15, 2023
0e0586f
c_importer_product: fix docstring
simahawk Jun 5, 2023
75e9c7a
c_importer_product: split find_attr
simahawk Jun 5, 2023
a5f7742
c_importer_product: add unit tests for record_handler
simahawk Jun 5, 2023
4b3712b
c_importer_product: split handling of tmpl xid
simahawk Jun 5, 2023
158b144
c_importer_product: create attr value if missing
simahawk Jun 5, 2023
72cadb8
connector_importer_product: migrate to v16
simahawk Mar 6, 2023
7b5fdd6
connector_importer_product: fix transl string params
simahawk Sep 4, 2024
9435361
Added translation using Weblate (Italian)
mymage Sep 9, 2024
8616fc6
[IMP] connector_importer_product: pre-commit auto fixes
vvrossem Mar 20, 2025
5151415
[MIG] connector_importer_product: Migration to 18.0
vvrossem Mar 20, 2025
576ff09
fixup! [MIG] connector_importer_product: Migration to 18.0
vvrossem Mar 20, 2025
b71e376
fixup! [MIG] connector_importer_product: Migration to 18.0
vvrossem Mar 27, 2025
4f2c0bc
fixup! [MIG] connector_importer_product: Migration to 18.0
vvrossem Mar 27, 2025
60a11cb
connector_importer_product: Avoid unnecessary code execution
Ricardoalso Sep 6, 2024
12cd811
connector_importer_product: Do not override product_tmpl_id
Ricardoalso Sep 11, 2024
16d8fae
pre-commit: run hook
Ricardoalso Jul 16, 2025
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
94 changes: 94 additions & 0 deletions connector_importer_product/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
==========================
Connector Importer Product
==========================

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

.. |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-OCA%2Fconnector--interfaces-lightgray.png?logo=github
:target: https://github.com/OCA/connector-interfaces/tree/18.0/connector_importer_product
:alt: OCA/connector-interfaces
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/connector-interfaces-18-0/connector-interfaces-18-0-connector_importer_product
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/connector-interfaces&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Ease definition of product imports using connector_importer.

Supported imports:

- products
- product attributes
- product attribute values
- product categories
- product packaging
- product supplier info

**Table of contents**

.. contents::
:local:

Known issues / Roadmap
======================

- get rid of supplier info specific importer
- find a flexible way to define matching products

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/connector-interfaces/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/OCA/connector-interfaces/issues/new?body=module:%20connector_importer_product%0Aversion:%2018.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
-------

* Camptocamp

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

- Simone Orsi <simahawk@gmail.com>
- Sébastien Alix <sebastien.alix@camptocamp.com>
- Jacques-Etienne Baudoux <je@bcim.be>
- Matthieu Méquignon <matthieu.mequignon@camptocamp.com>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/connector-interfaces <https://github.com/OCA/connector-interfaces/tree/18.0/connector_importer_product>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions connector_importer_product/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import components
25 changes: 25 additions & 0 deletions connector_importer_product/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2022 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
"name": "Connector Importer Product",
"summary": "Ease definition of product imports using `connector_importer`.",
"version": "18.0.1.0.0",
"category": "Tools",
"website": "https://github.com/OCA/connector-interfaces",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": [
# oca
"connector_importer",
# src
"product",
],
"data": [
"data/import_type.xml",
],
"demo": [
"demo/import_backend.xml",
"demo/import_source.xml",
"demo/import_recordset.xml",
],
}
3 changes: 3 additions & 0 deletions connector_importer_product/components/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import common
from . import product_product
from . import product_supplierinfo
9 changes: 9 additions & 0 deletions connector_importer_product/components/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2022 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo.addons.component.core import Component


class CommonProductImporter(Component):
_name = "common.product.importer"
_inherit = "importer.record"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import record_handler
from . import mapper
75 changes: 75 additions & 0 deletions connector_importer_product/components/product_product/mapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Copyright 2022 Camptocamp SA
# 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
from odoo.addons.connector_importer.utils.mapper_utils import backend_to_rel


class ProductProductMapper(Component):
_name = "product.product.mapper"
# Non mapped fields will be managed by the dynamic mapper
_inherit = "importer.mapper.dynamic"
_apply_on = "product.product"
_mapper_usage = "importer.mapper"

direct = [
(
backend_to_rel(
"tmpl_default_code",
# When you want to related a template via code
# this kind of search is mandatory
# because Odoo will set the template.default_code to false
# every time it has more than one variant.
# We assume that if you are using `tmpl_default_code`
# all the variants in your dataset either have the same code
# or at least one of them has default_code = tmpl_default_code.
search_field="product_variant_ids.default_code",
),
"product_tmpl_id",
),
]
required = {
"name": "name",
}
translatable = ["name"]

defaults = [("sale_ok", True)]

@mapping
def code(self, record):
"""Ensure there's always a default code.

We must have a default code to univocally find the template
if it's already created.
In your dataset you might not care about having a default code per variant
which means that likely you'll have only `tmpl_default_code`.
If that's the case, we case, the 1st variant that will create the product
and its template, won't have a default_code for it and any subsequent lookup
of the template will fail.
"""
vals = {}
for key in ("default_code", "tmpl_default_code"):
if record.get(key):
vals["default_code"] = record[key]
break
return vals

def finalize(self, map_record, values):
res = super().finalize(map_record, values)
# Avoid having an empty barcode which must be unique.
# Odoo will try to store the barcode as an empty string
# whenever is not valued: simply ignore it when it happens
# to avoid:
# psycopg2.errors.UniqueViolation: duplicate key value
# violates unique constraint "product_product_barcode_uniq".
#
# Note: this can be achieved by using this mapper option:
#
# source_key_empty_skip:
# - barcode
#
# Since we have a special mapper, let's handle it here.
if "barcode" in res and not res.get("barcode"):
res.pop("barcode")
return res
Loading