域在搜索视图中无法正常工作
在机会中,我有水平和垂直两种用户类别。当垂直用户登录时,他/她的名字出现在垂直字段中,但是当水平用户登录时,他/她的名字也出现在垂直用户字段而不是水平用户字段中.我在搜索视图中应用了域,如下所示-
对于水平用户:
<field name="user_id" string ="Salesman Horizontal" domain = "
[('tri_salesteam.s_horizontal','=',True),'|','|','|','|','|','|','|','|',
('parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id','=',uid),('parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id','=',uid),('parent_id.parent_id','=',uid),
('id','in',[uid])]" invisible="1">
对于垂直用户:
<field name="sales_vertical" domain = "
[('tri_salesteam.s_horizontal','!=',True),'|','|','|','|','|','|','|','|',
('parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id','=',uid),('parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id','=',uid),('id','in',[uid])]" invisible="1">
In Opportunity I have 2 categories of user horizontal and vertical.When a vertical user logs in ,his/her name appears in vertical field,but when a hortizontal user logs in his/her name also appears in vertical user field instead of horizontal user field.I have applied domain in search view as below-
for Horizontal user:
<field name="user_id" string ="Salesman Horizontal" domain = "
[('tri_salesteam.s_horizontal','=',True),'|','|','|','|','|','|','|','|',
('parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id','=',uid),('parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id','=',uid),('parent_id.parent_id','=',uid),
('id','in',[uid])]" invisible="1">
for Vertical user:
<field name="sales_vertical" domain = "
[('tri_salesteam.s_horizontal','!=',True),'|','|','|','|','|','|','|','|',
('parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id.parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id','=',uid),('parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id.parent_id','=',uid),
('parent_id.parent_id.parent_id','=',uid),('id','in',[uid])]" invisible="1">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不太确定你在问什么,但这里有一个调试搜索条件的提示。在服务器代码的
orm._search()
方法中放置断点或调试语句。在版本 6.0.3 中,它位于server/bin/osv/orm.py
的第 4029 行,如下所示:如果您转储
where_str
的内容,那么您可以看看你的约束是如何被解释的。I'm not really sure what you're asking, but here's a hint for debugging search conditions. Put a breakpoint or a debug statement in the server code's
orm._search()
method. In version 6.0.3, it's on line 4029 ofserver/bin/osv/orm.py
and looks like this:If you dump the contents of
where_str
, then you can see how your constraints are being interpreted.尝试在域中使用“parent_of”和“child_of”,而不是使用这么多“|”搜索parent_id的条件。
Try to use 'parent_of' and 'child_of' in domain instead of using this much '|' conditions for searching the parent_id.