How to rewrite field sum with read_group in odoo8

I want to change the sum of the obj_global field, but I can not do this

enter image description here

I am rewriting the read_group function, but I don’t have the correct amount, I want to have the Total amount = group amount for section_id: 130,000 = 10,000 + 70,000 + 50,000 think about our help

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
+4
source share

All Articles