Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
1387 Prikazi

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
Opusti
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
Opusti
Avtor

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

Avtor

This worked! Thank you Andry.

Avtor Best Answer

Here's a screenshot of one of the products attributes

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
1
okt. 23
2236
2
apr. 16
14905
3
jun. 25
874
3
jul. 24
2066
2
apr. 24
2813