Commit 20a7fdb8 authored by Jérome Perrin's avatar Jérome Perrin

fixup! accounting: Optimize initial balance calculation

we should not call getInventoryList if there is no account_type_to_group_by_mirror_section_previous_period
parent c3f37168
......@@ -501,7 +501,8 @@ for node in getInventoryList(\n
\n
# payable / receivable accounts {{{\n
# initial balance\n
for node in getInventoryList(\n
if account_type_to_group_by_mirror_section_previous_period:\n
for node in getInventoryList(\n
node_category_strict_membership=account_type_to_group_by_mirror_section_previous_period,\n
group_by_mirror_section=1,\n
group_by_node=1,\n
......@@ -524,7 +525,8 @@ for node in getInventoryList(\n
\n
found_balance=False\n
# Balance Transactions\n
for node in getInventoryList(\n
if account_type_to_group_by_mirror_section_previous_period:\n
for node in getInventoryList(\n
node_category_strict_membership=account_type_to_group_by_mirror_section_previous_period,\n
group_by_mirror_section=1,\n
group_by_node=1,\n
......@@ -711,7 +713,7 @@ for key, data in line_per_account.items():\n
closing_balance = final_debit_balance - final_credit_balance\n
total_final_balance_if_debit += round(max(closing_balance, 0), precision)\n
total_final_balance_if_credit += round(max(-closing_balance, 0) or 0, precision)\n
\n
\n
line = Object(uid=\'new_\',\n
node_id=node_id,\n
node_title=node_title,\n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment