minor fix

This commit is contained in:
wilson gomez 2021-08-12 09:06:52 -05:00
parent 61abf29595
commit 2dd624f2bd
1 changed files with 9 additions and 5 deletions

View File

@ -1575,10 +1575,12 @@ class AuxiliaryParty(Report):
lines = MoveLine.search(dom_lines, order=[('move.date', 'ASC')])
res = {}
accounts_id = {}
print(lines, len(lines))
if lines:
for line in lines:
if not line.party:
continue
print(line.party, line.account.id)
if data['only_reference']:
id_ = line.reference
name = line.reference
@ -1637,11 +1639,11 @@ class AuxiliaryParty(Report):
'id_number': id_number,
'accounts': [],
}
res[id_]['accounts'].append(line.account.id)
if id_ not in accounts_id.keys():
accounts_id[id_] = {}
if accounts_id not in accounts_id[id_].keys():
# if id_ not in accounts_id.keys():
if account_id not in accounts_id[id_].keys():
accounts_id[id_][account_id] = {
'account': line.account,
'lines': [],
@ -1649,12 +1651,14 @@ class AuxiliaryParty(Report):
'sum_credit': [],
'balance': []
}
res[id_]['accounts'].append(account_id)
accounts_id[id_][account_id]['lines'].append(line)
accounts_id[id_][account_id]['sum_debit'].append(line.debit)
accounts_id[id_][account_id]['sum_credit'].append(line.credit)
accounts_id[id_][account_id]['balance'].append(line.debit - line.credit)
# print('records', res)
# print('aconuts', account_id)
report_context['_records'] = res
report_context['_accounts'] = accounts_id
report_context['grouped_by_account'] = data['grouped_by_account']