Hi Jeremy & Christophe
Totally get it — handling attributes like Size across 20,000 products in Odoo 14 can get tricky fast, especially with imports. The issue you’re facing is pretty common and usually tied to how Odoo 14 manages attribute lines and variant regeneration.
In Odoo 14, product variants are tightly linked to the attribute lines on the product template. If your import tries to remove an attribute (like “Size”) that’s actively generating variants, Odoo throws errors because it can’t reconcile the variant definitions.
Here’s how you can cleanly remove the “Size” attribute in bulk:
Step 1: Identify and unlink “Size” from attribute lines
Use the model product.template.attribute.line — export the records where attribute_id = Size.
In your export (via Excel or CSV):
-
Include fields: id, product_tmpl_id/id, attribute_id/id, value_ids/id
Then, either:
-
Manually delete those lines via the UI (tedious)
-
Or import a file with just the id column and leave all other fields empty to remove the line — or write a small script to unlink them.
Step 2: Remove obsolete variants
After removing the attribute lines, Odoo won’t automatically delete the existing product variants that had Size. You’ll need to remove them manually or through a script:
# WARNING: Use with caution. Only run after unlinking attribute lines.
size_attr = env['product.attribute'].search([('name', '=', 'Size')])
variant_ids = env['product.product'].search([
('product_template_attribute_value_ids.attribute_id', '=', size_attr.id)
])
variant_ids.unlink()
Make sure those variants aren't tied to existing sales ordes, stock moves or accounting records, otherwise odoo won't let you delete them.
Step 3: Rebuild your variants (optional)
If your products now only need Color or Location, you can go to each template and click “Update Variants” or trigger it via code. In Odoo 14, this sometimes has to be done template by template unless you automate it.
Tips for keeping it clean going forward
-
Disable the Size attribute (active = False) so it’s not reused in the future.
-
Add logic to your import scripts to exclude deprecated attributes.
-
If you’re doing catalog management at this scale regularly, consider a small module that gives you admin tools to clean attributes in bulk.
Let me know if you want help generating an import file or action script for this — no way you’re doing 20,000 one by one.