تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
1974 أدوات العرض

Hi,

I want to add a function on adding a many2many, and then on removing from many2many i want to add a different function as well. 

If for example on adding customers in a many2many fields, followers are added for that saleorder,

then on removing from that many2many it should do the opposite remove follower from sale order.

How to solve this 

الصورة الرمزية
إهمال

You are mentioning a very specific difficult scenario. So you better provide more details about what you wanna get it done. The examples you provided aren't good enough

أفضل إجابة

Hi,

You can inherit the create and write method of the main model, where you have added the many2many and achieve it. Inherit the write method, see the values writing into the db, if there is m2m field is triggered with write, perform your needed operation.


Inherit odoo write method: https://www.youtube.com/watch?v=sFmqEgnFyhs


Thanks

الصورة الرمزية
إهمال
أفضل إجابة

Hi,

Sure, you can do this by adding an onchange method to your model. The onchange method will be triggered whenever the value of the many2many field is changed. You can use this method to add or remove followers from the sale order.

Hope it helps

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
يونيو 23
2803
1
أبريل 25
1374
1
مايو 24
2407
Odoo App تم الحل
1
نوفمبر 23
1940
1
فبراير 24
2073