Openerp 如果从onchange字段返回的域没有选择值
我想将域放在Sales Person()上,以便只显示所选销售团队的Sales Person 为此,我在第_id节(销售团队)的_change()上创建了,并从该方法返回域。虽然当我进入开发者模式时,域显示在销售人员(用户id)上,但没有显示任何值 以下是代码:Openerp 如果从onchange字段返回的域没有选择值,openerp,onchange,Openerp,Onchange,我想将域放在Sales Person()上,以便只显示所选销售团队的Sales Person 为此,我在第_id节(销售团队)的_change()上创建了,并从该方法返回域。虽然当我进入开发者模式时,域显示在销售人员(用户id)上,但没有显示任何值 以下是代码: def onchange_section_id(self, cr, uid, ids, section_id, context=None): crm_case_section_obj = self.pool.get('crm.c
def onchange_section_id(self, cr, uid, ids, section_id, context=None):
crm_case_section_obj = self.pool.get('crm.case.section')
member_ids = []
if section_id:
member_ids = [member_id.id for member_id in crm_case_section_obj.browse(cr, uid, section_id, context=context).member_ids]
return {'domain': {'user_id': [('user_id', 'in', member_ids)]}}
我错过什么了吗
我想你在这里犯了一个小错误 以这种方式使用域:
{'domain':{'user_id':[('id','in',member_id)]}
def onchange_section_id(self, cr, uid, ids, section_id, context=None):
crm_case_section_obj = self.pool.get('crm.case.section')
member_ids = []
if section_id:
member_ids = [member_id.id for member_id in crm_case_section_obj.browse(cr, uid, section_id, context=context).member_ids]
return {'domain': {'user_id': [('id', 'in', member_ids)]}}
试试这个pooja,希望它能解决你最近的问题
def onchange_section_id(self, cr, uid, ids, section_id, context=None):
crm_case_section_obj = self.pool.get('crm.case.section')
member_ids = []
if section_id:
member_ids = [member_id.id for member_id in crm_case_section_obj.browse(cr, uid, section_id, context=context).member_ids]
return {'domain': {'user_id': [('id', 'in', member_ids)]}, 'value': {'user_id': False}}
这里的答案对我不起作用,但用户1576199的评论起了作用
def onchange_section_id(self, cr, uid, ids, section_id, context=None):
crm_case_section_obj = self.pool.get('crm.case.section')
member_ids = []
if section_id:
member_ids = [member_id.id for member_id in crm_case_section_obj.browse(cr, uid, section_id, context=context).member_ids]
return {'domain': {'user_id': str([('id', 'in', member_ids)]) }}
这里的诀窍是将实际域作为字符串传递,因为web客户端就是这样期望域的值的。因此,使用str([('id',in,member_id)])以另一种方式,我们可以通过在您的模块中获取核心模块和宫殿的整个标记来放置域,如in.xml,并给出父对象。如果你想展示你的域名,我会给出答案。因为这个问题我已经面对了。谢谢没有用。获取错误。DataError:整数的输入语法无效:“演示用户”第1行:…_id.“名称”为空)和中的(“res_用户”.“id”('Demo User…给你全部的回溯,你是openerp的学习者吗,你的错误表明这是我这边的错误。我发现了。是的。对朋友的不便表示歉意。你的代码使用起来似乎有点不友好。希望你不介意我是否会编辑你的答案,毕竟这是为了提供更好的解决方案。嗨,亲爱的,是的不是我的代码,这是pooja的代码我只是纠正了错误的事情,我不是来指导人们遵守pep8规则或修改代码的,我知道。即使没有人在这里指导pep8规则。我也不是在谈论这种改变。