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

Hi,

I am working on how to make a many2many tag widget clickable, when you click on any tag it takes you to the form view of the object represented by the clicked tag, here code example :

Python , field declaration :   

sale_ids = fields.Many2many('sale.order', 'sale_order_invoice_rel' , 'invoice_id','order_id', 'quotations')

Xml file : 

<field string="linked quotations" name="sale_ids"  widget="many2many_tags" options="{'no_open': False}" />

currently i'm working on a javascript function to do that, but if there's a tip on how to do that using xml or python i'd appreciate the help.

-------------------------------------------------------------------------------------------------

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

I am interested in this same feature. Did you ever get this functionality working?

الكاتب

Yes i did, using js

How you can achieve this using javascript?

الكاتب

please vote for the question to make it interesting, then i'll post a reply on how i could do it

OK. I vote you.

On 20/01/20 3:44 pm, mireda2012@gmail.com wrote:

please vote for the question to make it interesting, then i'll post a reply on how i could do it

Envoyé par Odoo S.A. using Odoo.

الكاتب

i answered it :)

Ok. Can you please help me. I have one problem. For example: I have one many2one widget in that there is create and edit option. after click on this option I want display model field value in that many2one widget. I hope you understand problem. if not then please let me know

On 20/01/20 5:27 pm, mireda2012@gmail.com wrote:

i answered it :)

Envoyé par Odoo S.A. using Odoo.

الكاتب أفضل إجابة

Hi,

I finally found a solution for this question.

Usually the Many2manyTags widget displays the name of the record, so i used javascript to get that name value and use in a query (search query based on cndition) to get the id of the record.

after you get the id you can execute an action using this id and the current tag model.

The query + the action should be inserted in the model javascript file located in Web/static/src/js , exactly in render_tag function.

Hope you vote if you find this informations usefull.

And thank you.

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

Can you post the code? I haven't done any JS coding in Odoo.

أفضل إجابة

This solution is the best one it works fine:

https://apps.odoo.com/apps/modules/13.0/dr_many_tags_link/

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
أبريل 24
1750
4
نوفمبر 23
5786
0
أكتوبر 23
1515
0
ديسمبر 22
2460
2
ديسمبر 23
19089