Browse Source

[CC] pep8 to parser.py

pull/7/merge
Yanina Aular 12 years ago
parent
commit
d610e788c5
  1. 40
      account_financial_report/report/parser.py

40
account_financial_report/report/parser.py

@ -435,7 +435,7 @@ class account_balance(report_sxw.rml_parse):
start_time = time.clock() start_time = time.clock()
############################################################### ###############################################################
#
# calculos optimos
# #
############################################################### ###############################################################
@ -454,15 +454,19 @@ class account_balance(report_sxw.rml_parse):
ctx_i = _ctx_init(self.context.copy()) ctx_i = _ctx_init(self.context.copy())
ctx_to_use = _ctx_init(self.context.copy()) ctx_to_use = _ctx_init(self.context.copy())
account_black_ids = account_obj.search(self.cr, self.uid, ([('id', 'in', [i[0] for i in account_ids]),('type','not in',('view','consolidation'))]))
account_black = account_obj.browse(self.cr, self.uid, account_black_ids, ctx_to_use)
account_black_ids = account_obj.search(self.cr, self.uid, ([('id', 'in', [i[
0] for i in account_ids]), ('type', 'not in', ('view', 'consolidation'))]))
account_black = account_obj.browse(
self.cr, self.uid, account_black_ids, ctx_to_use)
if form['inf_type'] == 'BF': if form['inf_type'] == 'BF':
account_black_init = account_obj.browse(self.cr, self.uid, account_black_ids, ctx_i)
account_black_init = account_obj.browse(
self.cr, self.uid, account_black_ids, ctx_i)
account_not_black_ids = account_obj.search(self.cr, self.uid, ([('id', 'in', [i[0] for i in account_ids]),('type','in',('view','consolidation'))]))
account_not_black = account_obj.browse(self.cr, self.uid, account_not_black_ids, ctx_to_use)
account_not_black_ids = account_obj.search(self.cr, self.uid, ([('id', 'in', [
i[0] for i in account_ids]), ('type', 'in', ('view', 'consolidation'))]))
account_not_black = account_obj.browse(
self.cr, self.uid, account_not_black_ids, ctx_to_use)
account_not_black.sort(key=lambda x: x.level) account_not_black.sort(key=lambda x: x.level)
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]
@ -484,8 +488,6 @@ class account_balance(report_sxw.rml_parse):
dict_black[i.id]['balanceinit'] = i.balance dict_black[i.id]['balanceinit'] = i.balance
######################### #########################
#~ No negros #~ No negros
dict_not_black = {} dict_not_black = {}
for i in account_not_black: for i in account_not_black:
@ -499,7 +501,8 @@ class account_balance(report_sxw.rml_parse):
dict_not_black[i.id] = not_black_data dict_not_black[i.id] = not_black_data
########################### ###########################
all_account = dict_black.copy() #se hace una copia, porque se modificara
all_account = dict_black.copy(
) # se hace una copia, porque se modificara
print "##################" print "##################"
for i in dict_not_black: for i in dict_not_black:
@ -509,11 +512,15 @@ class account_balance(report_sxw.rml_parse):
print dict_not_black[acc_id].get('obj').name print dict_not_black[acc_id].get('obj').name
acc_childs = dict_not_black[acc_id].get('obj').child_id acc_childs = dict_not_black[acc_id].get('obj').child_id
for child_id in acc_childs: for child_id in acc_childs:
dict_not_black[acc_id]['debit'] += all_account[child_id.id].get('debit')
dict_not_black[acc_id]['credit'] += all_account[child_id.id].get('credit')
dict_not_black[acc_id]['balance'] += all_account[child_id.id].get('balance')
dict_not_black[acc_id]['debit'] += all_account[
child_id.id].get('debit')
dict_not_black[acc_id]['credit'] += all_account[
child_id.id].get('credit')
dict_not_black[acc_id]['balance'] += all_account[
child_id.id].get('balance')
if form['inf_type'] == 'BF': if form['inf_type'] == 'BF':
dict_not_black[acc_id]['balanceinit'] += all_account[child_id.id].get('balanceinit')
dict_not_black[acc_id]['balanceinit'] += all_account[
child_id.id].get('balanceinit')
all_account[acc_id] = dict_not_black[acc_id] all_account[acc_id] = dict_not_black[acc_id]
print "##################" print "##################"
@ -524,23 +531,20 @@ class account_balance(report_sxw.rml_parse):
else: else:
all_account_period[period_ids[p_act]] = all_account all_account_period[period_ids[p_act]] = all_account
# pdb.set_trace() # pdb.set_trace()
# print "periodo 1 #######################" # print "periodo 1 #######################"
# for i in all_account_period.get(1): # for i in all_account_period.get(1):
# j = all_account_period.get(1).get(i) # j = all_account_period.get(1).get(i)
# print j.get('obj').name , j.get('debit') # print j.get('obj').name , j.get('debit')
# print "periodo 2 #######################" # print "periodo 2 #######################"
# for i in all_account_period.get(2): # for i in all_account_period.get(2):
# j = all_account_period.get(2).get(i) # j = all_account_period.get(2).get(i)
# print j.get('obj').name , j.get('debit') # print j.get('obj').name , j.get('debit')
# print all_account_period # print all_account_period
print time.clock() - start_time, "seconds" print time.clock() - start_time, "seconds"
# #
############################################################### ###############################################################
#
# Fin de calculos optimos, sumatoria de valores
# #
############################################################### ###############################################################

Loading…
Cancel
Save