Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
1392 Widoki

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.

Awatar
Odrzuć
Najlepsza odpowiedź

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
Awatar
Odrzuć
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 Najlepsza odpowiedź

Here's a screenshot of one of the products attributes

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
paź 23
2240
2
kwi 16
14905
3
cze 25
878
3
lip 24
2070
2
kwi 24
2813