Odoo中文社区可以通过以下三个域名访问:shine-it.net , odoocn.org,odoo.net.cn

原论坛用户的基本信息和发帖这里都予以保留,请注意:原论坛用户无需重新注册新用户,但是您的密码需要重置

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

Openerp的gtk客户端万能查询功能中文bug



  • 也不知道是不是BUG,也许是配置不对,请高手拍砖,我反正用下面方法解决问题了,以下是我的方法:
      GTK客户端与WEB客户端在增加过滤条件后,点击查询获得的结果不一致,根据后台数据库日志,可知GTK自定义的条件未提交.WEB客户端获得了正确的结果GTK却查询不出来,后台数据库日志捕获语句也不一样,相关图片见附件
    [code]
    根据不同的协议(net-rpc使用的是unicode,xml-rpc使用的是utf-8编码)OPENERP客户端储存了不同编码的值,而gtk客户端界面组件glade固定返回的编码为utf-8,在点击查找后,进行匹配时,无法找到对应的值,修改代码,将内存中全部转换为unicode,glade返回值也转换为unicode,修改如下(openerp-client-6.0.3/bin/widget_search/custom_filter.py):
    fields = attrs.get('fields',None)
    for item in fields:
    #add by py 将索引字段强制换成unicode
    self.field_selection[unicode(item[1])] = (item[0], item[2], item[3])
    #以下为原来的代码
    #self.field_selection[item[1]] = (item[0], item[2], item[3])
    #end by py
    self.combo_fields.append_text(item[1])

    self.combo_fields.set_active(0)

    for item in (['ilike', ('contains')],
    ['not ilike', ('doesn't contain')],
    ['=', ('is equal to')],
    ['<>',
    ('is not equal to')],
    ['>',
    ('greater than')],
    ['<',
    ('less than')],
    ['in',('in')],
    ['not in',
    ('not in')],
    ):
    #add by py 将索引字段强制换成unicode
    self.op_selection[unicode(item[1])] = item[0]
    #以下为原来的代码
    #self.op_selection[item[1]] = item[0]
    #end by py
    self.combo_op.append_text(item[1])

    self.combo_op.set_active(0)
    false_value_domain = []
    type_cast = {'integer':lambda x:int(x),
    'float':lambda x:float(x),
    'boolean':lambda x:bool(eval(x)),
    'date':lambda x:(datetime.strptime(x, DT_FORMAT)).strftime(DT_FORMAT),
    'datetime':lambda x:(datetime.strptime(x, DHM_FORMAT)).strftime(DHM_FORMAT)
    }
    #add by py
    field_left = self.field_selection[unicode(self.combo_fields.get_active_text())][0]
    field_type = self.field_selection[unicode(self.combo_fields.get_active_text())][1]
    operator = self.op_selection[unicode(self.combo_op.get_active_text())]
    #以下为原来的代码
    #field_left = self.field_selection[self.combo_fields.get_active_text()][0]
    #field_type = self.field_selection[self.combo_fields.get_active_text()][1]
    #operator = self.op_selection[self.combo_op.get_active_text()]
    #end by py
    right_text = self.right_text.get_text() or False
    [/code]



  • 也不知道是不是BUG,也许是配置不对,请高手拍砖,我反正用下面方法解决问题了,以下是我的方法:
      GTK客户端与WEB客户端在增加过滤条件后,点击查询获得的结果不一致,根据后台数据库日志,可知GTK自定义的条件未提交.WEB客户端获得了正确的结果GTK却查询不出来,后台数据库日志捕获语句也不一样,相关图片见附件
    [code]
    根据不同的协议(net-rpc使用的是unicode,xml-rpc使用的是utf-8编码)OPENERP客户端储存了不同编码的值,而gtk客户端界面组件glade固定返回的编码为utf-8,在点击查找后,进行匹配时,无法找到对应的值,修改代码,将内存中全部转换为unicode,glade返回值也转换为unicode,修改如下(openerp-client-6.0.3/bin/widget_search/custom_filter.py):
    fields = attrs.get('fields',None)
    for item in fields:
    #add by py 将索引字段强制换成unicode
    self.field_selection[unicode(item[1])] = (item[0], item[2], item[3])
    #以下为原来的代码
    #self.field_selection[item[1]] = (item[0], item[2], item[3])
    #end by py
    self.combo_fields.append_text(item[1])

    self.combo_fields.set_active(0)

    for item in (['ilike', ('contains')],
    ['not ilike', ('doesn&#039;t contain')],
    ['=', ('is equal to')],
    ['<>',
    ('is not equal to')],
    ['>',
    ('greater than')],
    ['<',
    ('less than')],
    ['in',('in')],
    ['not in',
    ('not in')],
    ):
    #add by py 将索引字段强制换成unicode
    self.op_selection[unicode(item[1])] = item[0]
    #以下为原来的代码
    #self.op_selection[item[1]] = item[0]
    #end by py
    self.combo_op.append_text(item[1])

    self.combo_op.set_active(0)
    false_value_domain = []
    type_cast = {'integer':lambda x:int(x),
    'float':lambda x:float(x),
    'boolean':lambda x:bool(eval(x)),
    'date':lambda x:(datetime.strptime(x, DT_FORMAT)).strftime(DT_FORMAT),
    'datetime':lambda x:(datetime.strptime(x, DHM_FORMAT)).strftime(DHM_FORMAT)
    }
    #add by py
    field_left = self.field_selection[unicode(self.combo_fields.get_active_text())][0]
    field_type = self.field_selection[unicode(self.combo_fields.get_active_text())][1]
    operator = self.op_selection[unicode(self.combo_op.get_active_text())]
    #以下为原来的代码
    #field_left = self.field_selection[self.combo_fields.get_active_text()][0]
    #field_type = self.field_selection[self.combo_fields.get_active_text()][1]
    #operator = self.op_selection[self.combo_op.get_active_text()]
    #end by py
    right_text = self.right_text.get_text() or False
    [/code]


登录后回复
 

与 Odoo 中文社区 的连接断开,我们正在尝试重连,请耐心等待