Skip to Content
Menu

Import Relation Fields with Duplicate Names (Import UOM)

by
Odoo

17.36

v 16.0 Third Party
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 21
Technical Name hh_import_relation_fields_with_duplicate_names
LicenseOPL-1
Versions 16.0 17.0 18.0
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 21
Technical Name hh_import_relation_fields_with_duplicate_names
LicenseOPL-1
Versions 16.0 17.0 18.0

Import Relation Fields with Duplicate Names

This module helps resolve import errors in Odoo when related records (Many2one fields) have duplicate names.

Problem

Normally, when you import data into Odoo and use a Many2one field (e.g., Unit of Measure, Product Category), Odoo identifies the related record by its name. However, if multiple records share the same name, the system cannot decide which one to link, and the import fails.

Solution

To fix this, this module allows you to provide more context when specifying related records.

You can use a special format to uniquely identify the related record, like this:

``category_id:Box 20 pills/Pill

In this format:

  • category_id is the name of the related field.
  • Box 20 pills is the value of a unique field in the related record (like a category name).
  • Pill is the display name (usually what Odoo uses as the record name).

Example Use Case

Imagine you have two units of measure both called "Pill", but they belong to different categories:

  • Category: Box 20 pills → Name: Pill
  • Category: Box 30 pills → Name: Pill

Using the standard import method, Odoo cannot tell which "Pill" you mean.

With this module, you can specify:

``category_id:Box 20 pills/Pill

This tells the system: “Link to the record whose name is Pill and whose category_id is Box 20 pills.”

How to Use

  1. Install the module.
  2. In your import file, for any Many2one field that might be ambiguous, use the pattern:
    ``parent_field:unique_name_parent_field/import_field_name
  3. Import as usual – the system will automatically resolve the correct record.

Features

  • Match related records with duplicate names using extra field values.
  • Works with any Many2one field.
  • No configuration needed – just use the right pattern.
Odoo Proprietary License v1.0

This software and associated files (the "Software") may only be used (executed,
modified, executed after modifications) if you have purchased a valid license
from the authors, typically via Odoo Apps, or if you have received a written
agreement from the authors of the Software (see the COPYRIGHT file).

You may develop Odoo modules that use the Software as a library (typically
by depending on it, importing it and using its resources), but without copying
any source code or material from the Software. You may distribute those
modules under the license of your choice, provided that this license is
compatible with the terms of the Odoo Proprietary License (For example:
LGPL, MIT, or proprietary licenses similar to this one).

It is forbidden to publish, distribute, sublicense, or sell copies of the Software
or modified copies of the Software.

The above copyright notice and this permission notice must be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author or have a question related to your purchase, please use the support page.