odoo在底部显示制定字段合计and汇总时显示合计
来源:互联网 发布:单片机汇编语言入门 编辑:程序博客网 时间:2024/05/02 12:20
- odoo的tree视图底部显示合计
tree 视图,底部显示指定字段合计数 ,视图中字段定义上在sum,
取自sale.view_order_tree 销售订单 tree 视图
取自sale.view_order_tree 销售订单 tree 视图
<field name="amount_total" sum="Total Tax Included"/>
- odoo使用group by分组时显示字段合计
来自:http://stackoverflow.com/questions/27536186/how-to-sum-other-columns-when-using-group-by-in-a-tree-view
方法是重写read_group方法
The key is to overwrite the
read_group
method of the class:class your_class(osv.osv): # ... def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False, lazy=True): res = super(your_class, self).read_group(cr, uid, domain, fields, groupby, offset, limit=limit, context=context, orderby=orderby, lazy=lazy) if 'amount_pending' in fields: for line in res: if '__domain' in line: lines = self.search(cr, uid, line['__domain'], context=context) pending_value = 0.0 for current_account in self.browse(cr, uid, lines, context=context): pending_value += current_account.amount_pending line['amount_pending'] = pending_value if 'amount_payed' in fields: for line in res: if '__domain' in line: lines = self.search(cr, uid, line['__domain'], context=context) payed_value = 0.0 for current_account in self.browse(cr, uid, lines, context=context): payed_value += current_account.amount_payed line['amount_payed'] = payed_value return res
If you want, for example, remove the sum of a column in the group by, you can do something like this:
class your_class(osv.osv): # ... def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False, lazy=True): if 'column' in fields: fields.remove('column') return super(your_class, self).read_group(cr, uid, domain, fields, groupby, offset, limit=limit, context=context, orderby=orderby, lazy=lazy):
0 0
- odoo在底部显示制定字段合计and汇总时显示合计
- DataGridView实现添加合计行并始终显示在底部
- DataGridView实现添加合计行并始终显示在底部
- DataGridView实现添加合计行并始终显示在底部
- DataGridView实现添加合计行并始终显示在底部
- 在SmartDataGrid底部显示合计栏的方法
- DataGridView实现添加合计行并始终显示在底部
- DataGridView实现添加合计行并始终显示在底部
- cxGrid显示'合计'
- DataGridView实现添加合计行并始终显示在底部收藏
- [转载]DataGridView实现添加合计行并始终显示在底部
- DataGrid脚眉显示合计
- DataGrid脚眉显示合计
- GridView 显示数据,在页脚添加合计
- 在水晶报表中怎样显示页合计
- cognos本页合计+本表合计,不分页显示
- Jqgrid 底部合计功能
- 在DataGrid中添加一个合计字段
- node.js在windows下的环境搭建
- 关系数据库设计范式介绍
- 改善既有代码的设计(二)----------重构和性能
- mysql 在Linux中启动关闭
- 编写代码实现,模拟用户登录情景,并且只能登录三次。 只允许输入三次密码,如果密码正确则提示登录成,如果三次均输入错误,则退出程序。
- odoo在底部显示制定字段合计and汇总时显示合计
- fork与vfork遇到的一个问题
- vs中检测内存泄漏的方法
- POJ 2488 DFS水题
- 面试题总结1
- 编写一个程序解决选择问题
- 使用BCG创建Pie
- HDU-2128
- ArcGIS Runtime SDK for Android 各版本下载地址及介绍