如何在Odoo中过滤many2one res.parner字段 [英] How to filter many2one res.parner field in odoo
本文介绍了如何在Odoo中过滤many2one res.parner字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有
x_trainer_id = fields.Many2one('res.partner', string='Trainer')
字段,我想通过partner form
的category_id
标记字段中放置的值来过滤其中的数据.
field, and I want to filter data in it by the value that is put in category_id
tag field in partner form
.
我只想显示其中的category_id
标签值定义为Trainer的那些记录.
I want to show just those records in it their category_id
tag value is defined Trainer.
推荐答案
如果我正确理解此方法,请尝试在视图中定义您的字段,例如:
If i understand this correct, try to define you field in your view like:
<field name="x_trainer_id" domain="[('category_id','=',category_id[0][2])]" />
字段category_id
也必须在该视图中定义.但是,如果您扩展res.partner视图,应该没有任何问题.
The field category_id
has to be defined in that view, too. But if you extend the res.partner views, there shouldn't be any problem.
这篇关于如何在Odoo中过滤many2one res.parner字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文