|
@ -440,8 +440,23 @@ class account_balance(report_sxw.rml_parse): |
|
|
('view', 'consolidation'))])) |
|
|
('view', 'consolidation'))])) |
|
|
|
|
|
|
|
|
account_not_black_ids = account_obj.search(self.cr, self.uid, ([('id', 'in', [ |
|
|
account_not_black_ids = account_obj.search(self.cr, self.uid, ([('id', 'in', [ |
|
|
i[0] for i in all_account_ids]), ('type', 'in', ('view', 'consolidation'))])) |
|
|
|
|
|
|
|
|
i[0] for i in all_account_ids]),('type', '=', 'view')])) |
|
|
|
|
|
|
|
|
|
|
|
acc_cons_ids = account_obj.search(self.cr, self.uid, ([('id', 'in', [ |
|
|
|
|
|
i[0] for i in all_account_ids]), ('type', 'in', ('consolidation',))])) |
|
|
|
|
|
|
|
|
|
|
|
account_consol_ids = account_obj._get_children_and_consol( |
|
|
|
|
|
self.cr, self.uid, acc_cons_ids) |
|
|
|
|
|
|
|
|
|
|
|
account_black_ids += account_obj.search(self.cr, self.uid, ( |
|
|
|
|
|
[('id', 'in', account_consol_ids ), |
|
|
|
|
|
('type', 'not in', |
|
|
|
|
|
('view', 'consolidation'))])) |
|
|
|
|
|
|
|
|
|
|
|
c_account_not_black_ids = account_obj.search(self.cr, self.uid, ([ |
|
|
|
|
|
('id', 'in', account_consol_ids), |
|
|
|
|
|
('type', '=', 'view')])) |
|
|
|
|
|
|
|
|
# This could be done quickly with a sql sentence |
|
|
# This could be done quickly with a sql sentence |
|
|
account_not_black = account_obj.browse( |
|
|
account_not_black = account_obj.browse( |
|
|
self.cr, self.uid, account_not_black_ids) |
|
|
self.cr, self.uid, account_not_black_ids) |
|
@ -449,6 +464,21 @@ class account_balance(report_sxw.rml_parse): |
|
|
account_not_black.reverse() |
|
|
account_not_black.reverse() |
|
|
account_not_black_ids = [i.id for i in account_not_black] |
|
|
account_not_black_ids = [i.id for i in account_not_black] |
|
|
|
|
|
|
|
|
|
|
|
c_account_not_black = account_obj.browse( |
|
|
|
|
|
self.cr, self.uid, c_account_not_black_ids) |
|
|
|
|
|
c_account_not_black.sort(key=lambda x: x.level) |
|
|
|
|
|
c_account_not_black.reverse() |
|
|
|
|
|
c_account_not_black_ids = [i.id for i in c_account_not_black] |
|
|
|
|
|
|
|
|
|
|
|
acc_cons_brw = account_obj.browse( |
|
|
|
|
|
self.cr, self.uid, acc_cons_ids) |
|
|
|
|
|
acc_cons_brw.sort(key=lambda x: x.level) |
|
|
|
|
|
acc_cons_brw.reverse() |
|
|
|
|
|
acc_cons_ids = [i.id for i in acc_cons_brw] |
|
|
|
|
|
|
|
|
|
|
|
account_not_black_ids = c_account_not_black_ids + acc_cons_ids + account_not_black_ids |
|
|
|
|
|
account_not_black = c_account_not_black + acc_cons_brw + account_not_black |
|
|
|
|
|
|
|
|
all_account_period = {} # All accounts per period |
|
|
all_account_period = {} # All accounts per period |
|
|
|
|
|
|
|
|
# Iteration limit depending on the number of columns |
|
|
# Iteration limit depending on the number of columns |
|
@ -514,7 +544,9 @@ class account_balance(report_sxw.rml_parse): |
|
|
) #It makes a copy because they modify |
|
|
) #It makes a copy because they modify |
|
|
|
|
|
|
|
|
for acc_id in account_not_black_ids: |
|
|
for acc_id in account_not_black_ids: |
|
|
acc_childs = dict_not_black.get(acc_id).get('obj').child_id |
|
|
|
|
|
|
|
|
acc_childs = dict_not_black.get(acc_id).get('obj').type=='view' \ |
|
|
|
|
|
and dict_not_black.get(acc_id).get('obj').child_id \ |
|
|
|
|
|
or dict_not_black.get(acc_id).get('obj').child_consol_ids |
|
|
for child_id in acc_childs: |
|
|
for child_id in acc_childs: |
|
|
dict_not_black.get(acc_id)['debit'] += all_account.get( |
|
|
dict_not_black.get(acc_id)['debit'] += all_account.get( |
|
|
child_id.id).get('debit') |
|
|
child_id.id).get('debit') |
|
|