Skip to Content
Menu
This question has been flagged
2 Replies
1014 Views

We have hundreds of products that we need to remove attribute values from. These are not product variants, only product specs. We want to re-do them, so we need to delete them first. I've been trying to do it by importing them with empty values, but Odoo always throws an error telling me that an attribute line cannot have an empty value, which makes no sense because I can easily make it so by manually deleting the value on the product sheet. 

How can we automate this or do it in bulk? 

See the screenshot I posted in my reply below.

Avatar
Discard
Best Answer

Hi Anton,

When you are defining Attribute, you also need to define the value at least one.

So, if you try to upload to delete, that's not possible because you cannot leave the "Product Attributes / Attribute" empty as it's mandatory by system.

I think you are able to delete it manually because you are using the 🗑️ icon which delete the whole line instead of update the lines to empty.

If you consider to delete all, you can try to create a function through "Scheduled Actions" menu (developer mode only). You can follow below screenshot and code snippet
🚨USE IT ON DEVELOPER ENVIRONMENT FIRST, DON'T DO IT IN PRODUCTION. THIS IS A VERY RISKY ACTION🚨

!!MAKE SURE YOU DON'T ACTIVE THIS SCHEDULED ACTION, RUN IT MANUALLY ONLY!!

model.search([]).attribute_line_ids.unlink()  # search with empty [] will select all active records
Avatar
Discard
Author

Thank you for the reply Andry. I can't find the "Scheduled Actions" in the developer menu.

I can't attach a screenshot to my comment but here is a link: https://imgur.com/1j2MyBj

Hi Anton, sorry it's unclear.
You can find the "Scheduled Actions" only if you activate "Developer Mode" which is the case now (based on your screenshot).

The "Scheduled Actions" is at
Settings > Technical > Scheduled Actions

Author

This worked! Thank you Andry.

Author Best Answer

Here's a screenshot of one of the products attributes

Avatar
Discard
Related Posts Replies Views Activity
1
Oct 23
1934
2
Apr 16
14591
3
Jun 25
548
3
Jul 24
1679
2
Apr 24
2635