如何用odoo8中的read_group覆盖字段总和

时间:2016-03-07 15:26:59

标签: python sum odoo-8

我想要改变字段obj_global的总和,但我不能这样做

enter image description here

我覆盖了函数read_group,但我没有正确的Sum 我想要 总和= group_id的组合:130000 = 10000 + 70000 + 50000 认为是我们的帮助

def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False, lazy=True):
    res = super(obj_report_line, self).read_group(cr, uid, domain, fields, groupby, offset, limit=limit, context=context, orderby=orderby, lazy=lazy)
    if 'obj_report_line' 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):                            

                    if 'section_id' in groupby and 'date' not in groupby:
                        pending_value = current_account.obj_global
                    else:
                        pending_value = 0.0
                    if
                        fields.remove('column')


                line['obj_global'] = pending_value


    return res

0 个答案:

没有答案