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

Dot*_*sia 5 python sum odoo-8

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

在此输入图像描述

我覆盖了函数read_group但是我没有正确的总和我希望总和= group by sum_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
Run Code Online (Sandbox Code Playgroud)