Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
1423 Переглядів

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.

Аватар
Відмінити
Найкраща відповідь

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
Аватар
Відмінити
Автор

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

Автор

This worked! Thank you Andry.

Автор Найкраща відповідь

Here's a screenshot of one of the products attributes

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
жовт. 23
2265
2
квіт. 16
14913
3
черв. 25
900
3
лип. 24
2090
2
квіт. 24
2820