Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
2676 Представления

Hi,


To clean up our database I'm trying to change the attribute values of certain products (model: product.product). For instance, I would like to change 36/XL to XL (which already exists in the database. What is the best method to do this? A simple export-import does not work, as there are multiple matches with other values. Is it possible to export the id and replace it with the proper one?

I also cannot change it on the product template, as that will result in the deletion and re-creation of product variants, an valuable information is lost in the process.

Kind regards,


Hidde

Аватар
Отменить
Лучший ответ

Hi,

If you tried to avoid the recomputation of various columns in the model "product.product", you should consider applying changes directly in Postgres. However this approach:

1. Is hard. You should modify not a single database table but a few related ones. The system of attribute values tables is quite complex in Odoo

2. Is risk-prone. Various recomputation and inverse triggers do quite an important job. You should take it into account since otherwise data will be inconsistent and will lead to errors.

So, in general, the "deletion and re-creation of product variants" you mentioned in your question is what is actually needed for such cases. Simple replacement of an attribute value is actually neither simple (needs to make SQL updates) nor good (might have severe consequences for data consistency).

If you decided to follow a common Odoo approach with all its subfunctions, please also consider this module - https://apps.odoo.com/apps/modules/16.0/product_management/. It is designed exactly to make mass template updates, including adding and removing attribute values (with variants recreation)

Аватар
Отменить
Related Posts Ответы Просмотры Активность
0
июл. 25
1563
2
нояб. 24
6658
2
окт. 24
3566
2
авг. 24
2052
3
июл. 24
8442