Predictable XML IDs for product attribute values

Reference every product variant value by a stable external ID, in imports, exports and integrations, without looking up database ids.

Predictable XML IDs for attribute values

Import variants

Point to a variant value with product_template_attribute_value.<id> in CSV or Excel imports, for extra prices, exclusions or variant combinations.

Stable everywhere

The ID is built from the XML IDs of the product template and the attribute value, so it is the same in every database: test, staging and production.

No configuration

Install the module and every new attribute value on a product gets its XML ID. One button generates the missing ones for existing products.

How the XML ID is built

When Odoo adds an attribute value to a product template, for example when you add Size: L to a Desk Organizer, the module gives the new record the XML ID:

product_template_attribute_value.<template>_<value>

product_template_attribute_value.desk_organizer_product_template_size_attribute_l
  • <template> is the name of the XML ID of the product template, <value> the name of the XML ID of the attribute value.
  • Characters that are not allowed in an XML ID are replaced by an underscore.
  • Records whose template or attribute value has no XML ID are skipped: their ID would not be predictable.
  • An ID that is already used by another record is never overwritten; the conflict is logged as a warning.

Generate the XML IDs of existing products

Go to Sales > Products > Product Template Attribute Values and click Generate XML IDs above the list. All attribute values without an XML ID get one, and Odoo tells you how many were created.

The Generate XML IDs button and its notification

Find them under External Identifiers

The XML IDs are regular external identifiers, in the product_template_attribute_value module. Search them in Settings > Technical > External Identifiers, or export them with the ID column of any export.

Generated XML IDs in the External Identifiers list

Good to know

  • Products created in the interface have no XML ID. Give them one through an import, or with any data migration tool, and their attribute values follow.
  • The XML IDs are stored with noupdate, and are kept when the module is uninstalled.
  • Part of the Fluvo toolset for fast data import and export in Odoo. Open source under the LGPL-3 license.