def _get_children_and_consol(self, cr, uid, ids, context={}):
#this function search for all the children and all consolidated children (recursively) of the given account ids
- res = self.search(cr, uid, [('parent_id', 'child_of', ids)])
- for id in res:
- this = self.browse(cr, uid, id, context)
- for child in this.child_consol_ids:
- if child.id not in res:
- res.append(child.id)
- if len(res) != len(ids):
- return self._get_children_and_consol(cr, uid, res, context)
- return res
+ ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)
+ ids3 = []
+ for rec in self.browse(cr, uid, ids2, context=context):
+ for child in rec.child_consol_ids:
+ ids3.append[child.id]
+ if ids3:
+ ids3 = self._get_children_and_consol(cr, uid, ids3, context)
+ return ids2+ids3
def __compute(self, cr, uid, ids, field_names, arg, context={}, query=''):
#compute the balance/debit/credit accordingly to the value of field_name for the given account ids