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

class Task(models.Model)  from project.py ( https://github.com/odoo/odoo/blob/db994ca57af4f09953946dede3950c2eb7a94871/addons/project/models/project.py#L339 ) has ` tag_ids = fields.Many2many('project.tags', string='Tags', oldname='categ_ids')`

And Project's task form contains "Tags" drop-down which opens tags search form. How can I apply the following domain to that form: domain should be the following `{'domain': {'tag_ids': [('id', 'in', tag_ids)]}}` where tag_ids is from

for task in self.project_id.task_ids:

    tag_ids += task.tag_ids.ids

 

?

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

return the domain list on onchange of tag_ids.

ie

@api.onchange('tag_ids')
def x(self):
....
return {'domain': {'tag_ids': [('id', 'in', tag_ids)]}}
الصورة الرمزية
إهمال
أفضل إجابة

1    @api.onchange('tag_ids')
2    def _tag_id_onchange(self):
3        res = {}
                   # your logic goes here for tag_ids
4        res['domain']={'tag_ids':[('id', 'in', tag_ids)]}
5        return res

Reference: http://learnopenerp.blogspot.com/2016/10/onchange-many2one-filed-in-odoo.html

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مارس 16
10899
6
سبتمبر 20
20047
1
مايو 18
8577
2
مايو 18
4484
2
مارس 15
5047