Eugene Molotov
10 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
16 additions and
9 deletions
-
dynamic_accounts_report/wizard/balance_sheet.py
-
dynamic_accounts_report/wizard/general_ledger.py
-
dynamic_accounts_report/wizard/partner_leadger.py
|
|
@ -1,4 +1,5 @@ |
|
|
|
import time |
|
|
|
from collections import defaultdict |
|
|
|
from odoo import fields, models, api, _ |
|
|
|
|
|
|
|
import io |
|
|
@ -492,11 +493,11 @@ class BalanceSheetView(models.TransientModel): |
|
|
|
|
|
|
|
cr.execute(sql, params) |
|
|
|
|
|
|
|
balance_dict = defaultdict(float) |
|
|
|
for row in cr.dictfetchall(): |
|
|
|
balance = 0 |
|
|
|
for line in move_lines.get(row['account_id']): |
|
|
|
balance += round(line['debit'], 2) - round(line['credit'], 2) |
|
|
|
balance = balance_dict[row['account_id']] |
|
|
|
row['balance'] += (round(balance, 2)) |
|
|
|
balance_dict[row['account_id']] += round(row['debit'], 2) - round(row['credit'], 2) |
|
|
|
row['m_id'] = row['account_id'] |
|
|
|
move_lines[row.pop('account_id')].append(row) |
|
|
|
# Calculate the debit, credit and balance for Accounts |
|
|
|
|
|
@ -371,11 +371,16 @@ class GeneralView(models.TransientModel): |
|
|
|
params = (tuple(accounts.ids),) + tuple(where_params) |
|
|
|
cr.execute(sql, params) |
|
|
|
|
|
|
|
balance_dict = {} |
|
|
|
for row in cr.dictfetchall(): |
|
|
|
balance = 0 |
|
|
|
for line in move_lines.get(row['account_id']): |
|
|
|
balance += round(line['debit'],2) - round(line['credit'],2) |
|
|
|
if row['account_id'] in balance_dict: |
|
|
|
balance = balance_dict[row['account_id']] |
|
|
|
else: |
|
|
|
balance = balance_dict[row['account_id']] = 0 |
|
|
|
for line in move_lines.get(row['account_id']): |
|
|
|
balance += round(line['debit'], 2) - round(line['credit'], 2) |
|
|
|
row['balance'] += round(balance,2) |
|
|
|
balance_dict[row['account_id']] += round(row['debit'], 2) - round(row['credit'], 2) |
|
|
|
row['m_id'] = row['account_id'] |
|
|
|
move_lines[row.pop('account_id')].append(row) |
|
|
|
|
|
|
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
import time |
|
|
|
from collections import defaultdict |
|
|
|
from odoo import fields, models, api, _ |
|
|
|
|
|
|
|
import io |
|
|
@ -320,12 +321,12 @@ class PartnerView(models.TransientModel): |
|
|
|
|
|
|
|
account_list = {x.id: {'name': x.name, 'code': x.code} for x in accounts} |
|
|
|
|
|
|
|
balance_dict = defaultdict(float) |
|
|
|
for row in cr.dictfetchall(): |
|
|
|
balance = 0 |
|
|
|
if row['partner_id'] in move_lines: |
|
|
|
for line in move_lines.get(row['partner_id']): |
|
|
|
balance += round(line['debit'],2) - round(line['credit'],2) |
|
|
|
balance = balance_dict[row['partner_id']] |
|
|
|
row['balance'] += (round(balance, 2)) |
|
|
|
balance_dict[row['partner_id']] += round(row['debit'], 2) - round(row['credit'], 2) |
|
|
|
row['m_id'] = row['account_id'] |
|
|
|
row['account_name'] = account_list[row['account_id']]['name'] + "(" +account_list[row['account_id']]['code'] + ")" |
|
|
|
move_lines[row.pop('partner_id')].append(row) |
|
|
|