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

I've two models Product and ActiveIngredient

I want to have a many 2 many relationship between above 2 models

It means a product can have multiple active ingredients and an active ingredient can have multiple products

But I also want to store concentration data for specific product and its active ingredient, so I've to add one extra column in intermediate table where it stores productid and activeingredientid

so the intermediate table will be as below:

product_id, activeingredient_id, concetration


Can anyone help me how to achieve that because in laravel it was easy to add any extra column in intermediate table but don't know how to do that in odoo?

I also want user to add that data in product's form view.

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

If you need to add extra column between many2many from 2 table, then you can achieved it via:

  1. Add a new table, let say the name of the table is ProductIngredientLine
  2. Add three column into the table:  product_id, activeingredient_id, concetration
  3. Create relation one2many​from Product​ table into ProductIngredientLine​using product_id​ column as  Relation Field
Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
квіт. 25
1919
2
трав. 24
3379
1
жовт. 24
803
2
трав. 25
448
2
черв. 24
1216