odoo判断 用户是否是销售团队负责人的规则
-
domain [('team_id','ilike',user.sale_team_id.name),(user.id,'=',user.sale_team_id.user_id.id)];
报错
错误:
Odoo Server ErrorTraceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 619, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 309, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/usr/lib/python3/dist-packages/odoo/http.py", line 664, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 345, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 93, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 338, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 909, in call
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 510, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1277, in search_read
return self.do_search_read(model, fields, offset, limit, domain, sort)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1296, in do_search_read
return Model.web_search_read(domain, fields, offset=offset, limit=limit, order=sort)
File "/usr/lib/python3/dist-packages/odoo/addons/web/models/models.py", line 36, in web_search_read
records = self.search_read(domain, fields, offset=offset, limit=limit, order=order)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 4793, in search_read
records = self.search(domain or [], offset=offset, limit=limit, order=order)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 1600, in search
res = self._search(args, offset=offset, limit=limit, order=order, count=count)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 4339, in _search
self._apply_ir_rules(query, 'read')
File "/usr/lib/python3/dist-packages/odoo/models.py", line 4137, in _apply_ir_rules
where_clause, where_params, tables = Rule.domain_get(self._name, mode)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_rule.py", line 187, in domain_get
query = self.env[model_name].sudo()._where_calc(dom, active_test=False)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 4076, in _where_calc
e = expression.expression(domain, self)
File "/usr/lib/python3/dist-packages/odoo/osv/expression.py", line 674, in init
self.parse()
File "/usr/lib/python3/dist-packages/odoo/osv/expression.py", line 811, in parse
self.stack = [ExtendedLeaf(leaf, self.root_model) for leaf in self.expression]
File "/usr/lib/python3/dist-packages/odoo/osv/expression.py", line 811, in
self.stack = [ExtendedLeaf(leaf, self.root_model) for leaf in self.expression]
File "/usr/lib/python3/dist-packages/odoo/osv/expression.py", line 559, in init
self.check_leaf(internal)
File "/usr/lib/python3/dist-packages/odoo/osv/expression.py", line 615, in check_leaf
raise ValueError("Invalid leaf %s" % str(self.leaf))
ValueError: Invalid leaf (41, '=', 41)用的docker 的 odoo13开发的
-
@andy-huang 是在res.user里添加一个字段 用来计算吗。有具体步骤逻辑吗。公司业务需求 刚学odoo 还没太明白
-
@digitalsatori 大佬能提供思路吗
-
感觉你的问题的标题和内容不搭啊。
domain不是用来判断用户是否为销售团队负责人的,domain是用来作为过滤条件过滤记录的。你是要在什么对象上使用domain,想要如何过滤记录。 -
@digitalsatori 我现在大概了解了。用domain 无法过滤。
-
@digitalsatori 我的业务需求 是一个用户可以是多个团队负责人。然后可以查看负责团队的销售订单 或者 漏洞/线索。 这个大概是往哪个方向 入手。我看楼上说的添加一个计算字段 是什么逻辑。
-
@digitalsatori 谢谢 已解决 怎么标记这个问题已解决
-
不客气,常来交流。在“主题工具”里可以标记“问题已解决”。我已经帮你标记了。