Openerp7.0报表显示selection类型不正确问题
2014-10-18 21:05
148 查看
首先是引用:http://www.sandwych.com/Blog/161
写这篇文章的原因是该文只给了一个说明,对于一般的开发者还需要不少的时间摸索。反正我花了2,3个小时进行尝试,并测试
我使用的是rml生成pdf的打印方式。使用的系统默认的rml_parse。
所以需要做的内容是:
修改report_sxw文件rml_parse。
在__init__函数中增加两行。如下。使用原文的方式会报错。
self.localcontext['get_selection_item'] = self._get_selection_items('item')
self.localcontext['get_selection_items'] = self._get_selection_items()
另外是函数需要修改一下,把self.context修改为self.localcontext。因为rml_parse本身没有context成员对象
最后需要跟文章中描述的一样,把rml中的数据引用修改为get_selection_item(rml定义对象名, 具体字段名)的方式
写这篇文章的原因是该文只给了一个说明,对于一般的开发者还需要不少的时间摸索。反正我花了2,3个小时进行尝试,并测试
我使用的是rml生成pdf的打印方式。使用的系统默认的rml_parse。
所以需要做的内容是:
修改report_sxw文件rml_parse。
在__init__函数中增加两行。如下。使用原文的方式会报错。
self.localcontext['get_selection_item'] = self._get_selection_items('item')
self.localcontext['get_selection_items'] = self._get_selection_items()
另外是函数需要修改一下,把self.context修改为self.localcontext。因为rml_parse本身没有context成员对象
def _get_selection_items(self, kind='items'): def get_selection_item(obj, field, value=None): try: if isinstance(obj, browse_record_list): obj = obj[0] if isinstance(obj, (str,unicode)): model = obj field_val = value else: model = obj._table_name field_val = getattr(obj, field) if kind=='item': if field_val: return dict(self.pool.get(model).fields_get(self.cr, self.uid, allfields=[field], context=self.localcontext)[field]['selection'])[field_val] elif kind=='items': return self.pool.get(model).fields_get(self.cr, self.uid, allfields=[field], context=self.localcontext)[field]['selection'] return '' except Exception: return '' return get_selection_item
最后需要跟文章中描述的一样,把rml中的数据引用修改为get_selection_item(rml定义对象名, 具体字段名)的方式
相关文章推荐
- [原创]OpenERP 7.0 打印PDF报表 中文 乱码问题的解决方案。
- 在OpenERP报表中使用selection 类型字段
- 解决SharePoint无法正确显示文件类型图标问题
- openerp 7.0接收陌生邮件名称显示乱码问题解决方法
- <问题解决>数据库date类型数据前端页面显示格式不正确问题
- 在OpenERP报表中使用selection 类型字段
- VC数据库开发日记6: ACCESS中时间类型的查询和正确显示
- 解决Custom Field Type修改时属性显示不正确的问题
- 安讯报表发布到pdf后,字体只显示宋体效果问题的解决方法
- 关于管理系统或水晶报表显示小数是没有起零的问题
- 关于C#中货币类型和数值类型、字符串类型的转化和在DataGridView中的显示问题:
- 解决IE 7.0不能显示PNG图片的问题
- 水晶报报或reporting services做的报表在非简体中文地区的显示问题
- .Net 中无法正确显示中文问题
- mysql在dos下查询怎么正确显示中文的问题
- 【转载】EXCEL中条码问题:条形码能插入,但只有一种类型,数字不能改,修改属性后也不显示
- ActiveReport 使用心得(二):建立报表文件及中文显示的问题
- 关于附加码不能正确显示的问题
- INDY发送html邮件带附件邮件内容不能正确显示的问题
- 解决水晶报表不显示工具栏图标的问题