也不知道是不是BUG,也许是配置不对,请高手拍砖,我反正用下面方法解决问题了,以下是我的方法:
GTK客户端与WEB客户端在增加过滤条件后,点击查询获得的结果不一致,根据后台数据库日志,可知GTK自定义的条件未提交.WEB客户端获得了正确的结果GTK却查询不出来,后台数据库日志捕获语句也不一样,相关图片见附件
<br />根据不同的协议(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):<br />fields = attrs.get('fields',None)<br />for item in fields:<br />#add by py 将索引字段强制换成unicode<br />self.field_selection[unicode(item[1])] = (item[0], item[2], item[3])<br />#以下为原来的代码<br />#self.field_selection[item[1]] = (item[0], item[2], item[3])<br />#end by py<br />self.combo_fields.append_text(item[1])<br /><br />self.combo_fields.set_active(0)<br /><br />for item in (['ilike', _('contains')],<br />['not ilike', _('doesn\'t contain')],<br />['=', _('is equal to')],<br />['<>',_('is not equal to')],<br />['>',_('greater than')],<br />['<',_('less than')],<br />['in',_('in')],<br />['not in',_('not in')],<br />):<br />#add by py 将索引字段强制换成unicode<br />self.op_selection[unicode(item[1])] = item[0]<br />#以下为原来的代码<br />#self.op_selection[item[1]] = item[0]<br />#end by py<br />self.combo_op.append_text(item[1])<br /><br />self.combo_op.set_active(0)<br />false_value_domain = []<br />type_cast = {'integer':lambda x:int(x),<br />'float':lambda x:float(x),<br />'boolean':lambda x:bool(eval(x)),<br />'date':lambda x:(datetime.strptime(x, DT_FORMAT)).strftime(DT_FORMAT),<br />'datetime':lambda x:(datetime.strptime(x, DHM_FORMAT)).strftime(DHM_FORMAT)<br />}<br />#add by py<br />field_left = self.field_selection[unicode(self.combo_fields.get_active_text())][0]<br />field_type = self.field_selection[unicode(self.combo_fields.get_active_text())][1]<br />operator = self.op_selection[unicode(self.combo_op.get_active_text())]<br />#以下为原来的代码<br />#field_left = self.field_selection[self.combo_fields.get_active_text()][0]<br />#field_type = self.field_selection[self.combo_fields.get_active_text()][1]<br />#operator = self.op_selection[self.combo_op.get_active_text()]<br />#end by py<br />right_text = self.right_text.get_text() or False <br />