Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
967 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Autor

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

Autor

This worked! Thank you Andry.

Autor Mejor respuesta

Here's a screenshot of one of the products attributes

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
oct 23
1855
2
abr 16
14535
2
may 25
446
3
jul 24
1622
2
abr 24
2601