Commit 3bef8118 authored by Jérome Perrin's avatar Jérome Perrin

Initial balance should take into account recievable and payable accounts detailed per third party

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17396 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7695c122
......@@ -310,7 +310,13 @@ initial_balance_date = (from_date - 1).latestTime()\n
# standards accounts {{{\n
# balance at period start date\n
for node in getInventoryList(\n
node_category_strict_membership=account_type_to_group_by_node,\n
node_category_strict_membership=[\n
\'account_type/asset\',\n
\'account_type/asset/cash\',\n
\'account_type/asset/receivable/refundable_vat\',\n
\'account_type/liability/payable/collected_vat\',\n
\'account_type/equity\',\n
\'account_type/liability\',],\n
group_by_node=1,\n
to_date=period_start_date,\n
portal_type=accounting_movement_type_list +\n
......@@ -327,7 +333,13 @@ for node in getInventoryList(\n
\n
# Balance Transaction\n
for node in getInventoryList(\n
node_category_strict_membership=account_type_to_group_by_node,\n
node_category_strict_membership=[\n
\'account_type/asset\',\n
\'account_type/asset/cash\',\n
\'account_type/asset/receivable/refundable_vat\',\n
\'account_type/liability/payable/collected_vat\',\n
\'account_type/equity\',\n
\'account_type/liability\',],\n
group_by_node=1,\n
from_date=from_date,\n
at_date=from_date + 1,\n
......@@ -337,13 +349,20 @@ for node in getInventoryList(\n
(node[\'node_relative_url\'], MARKER, MARKER),\n
dict(debit=0, credit=0))\n
total_price = node[\'total_price\'] or 0\n
total_price += account_props.get(\'initial_debit_balance\', 0)\n
total_price -= account_props.get(\'initial_credit_balance\', 0)\n
account_props[\'initial_debit_balance\'] = max(total_price, 0)\n
account_props[\'initial_credit_balance\'] = max(- total_price, 0)\n
account_props[\'initial_debit_balance\'] = account_props.get(\n
\'initial_debit_balance\', 0) + max(total_price, 0)\n
account_props[\'initial_credit_balance\'] = account_props.get(\n
\'initial_credit_balance\', 0) + max(- total_price, 0)\n
\n
\n
for node in getInventoryList(\n
node_category_strict_membership=account_type_to_group_by_node,\n
node_category_strict_membership=[\n
\'account_type/asset\',\n
\'account_type/asset/cash\',\n
\'account_type/asset/receivable/refundable_vat\',\n
\'account_type/liability/payable/collected_vat\',\n
\'account_type/equity\',\n
\'account_type/liability\',],\n
group_by_node=1,\n
omit_output=1,\n
from_date=period_start_date,\n
......@@ -358,7 +377,13 @@ for node in getInventoryList(\n
\'initial_debit_balance\', 0) + total_price\n
\n
for node in getInventoryList(\n
node_category_strict_membership=account_type_to_group_by_node,\n
node_category_strict_membership=[\n
\'account_type/asset\',\n
\'account_type/asset/cash\',\n
\'account_type/asset/receivable/refundable_vat\',\n
\'account_type/liability/payable/collected_vat\',\n
\'account_type/equity\',\n
\'account_type/liability\',],\n
group_by_node=1,\n
omit_input=1,\n
from_date=period_start_date,\n
......@@ -408,45 +433,51 @@ for node in getInventoryList(\n
# }}}\n
\n
# payable / receivable accounts {{{\n
if account_type_to_group_by_mirror_section:\n
# initial balance\n
for node in getInventoryList(\n
node_category_strict_membership=\n
account_type_to_group_by_mirror_section,\n
group_by_mirror_section=1,\n
group_by_node=1,\n
to_date=period_start_date,\n
portal_type=accounting_movement_type_list +\n
balance_movement_type_list,\n
**inventory_params):\n
account_props = line_per_account.setdefault(\n
(node[\'node_relative_url\'], node[\'mirror_section_uid\'], MARKER),\n
dict(debit=0, credit=0))\n
total_price = node[\'total_price\'] or 0\n
account_props[\'initial_debit_balance\'] = account_props.get(\n
\'initial_debit_balance\', 0) + max(total_price, 0)\n
account_props[\'initial_credit_balance\'] = account_props.get(\n
\'initial_credit_balance\', 0) + max(-total_price, 0)\n
\n
# Balance Transactions\n
for node in getInventoryList(\n
node_category_strict_membership=\n
account_type_to_group_by_mirror_section,\n
group_by_mirror_section=1,\n
group_by_node=1,\n
from_date=from_date,\n
at_date=from_date + 1,\n
portal_type=balance_movement_type_list,\n
**inventory_params):\n
account_props = line_per_account.setdefault(\n
(node[\'node_relative_url\'], node[\'mirror_section_uid\'], MARKER),\n
dict(debit=0, credit=0))\n
total_price = node[\'total_price\'] or 0\n
total_price += account_props.get(\'initial_debit_balance\', 0)\n
total_price -= account_props.get(\'initial_credit_balance\', 0)\n
account_props[\'initial_debit_balance\'] = max(total_price, 0)\n
account_props[\'initial_credit_balance\'] = max(- total_price, 0)\n
# initial balance\n
for node in getInventoryList(\n
node_category_strict_membership=[\n
\'account_type/asset/receivable\',\n
\'account_type/liability/payable\', ],\n
group_by_mirror_section=1,\n
group_by_node=1,\n
to_date=period_start_date,\n
portal_type=accounting_movement_type_list +\n
balance_movement_type_list,\n
**inventory_params):\n
mirror_section_uid = MARKER\n
if expand_accounts:\n
mirror_section_key = node[\'mirror_section_uid\']\n
account_props = line_per_account.setdefault(\n
(node[\'node_relative_url\'], mirror_section_key, MARKER),\n
dict(debit=0, credit=0))\n
total_price = node[\'total_price\'] or 0\n
account_props[\'initial_debit_balance\'] = account_props.get(\n
\'initial_debit_balance\', 0) + max(total_price, 0)\n
account_props[\'initial_credit_balance\'] = account_props.get(\n
\'initial_credit_balance\', 0) + max(-total_price, 0)\n
\n
# Balance Transactions\n
for node in getInventoryList(\n
node_category_strict_membership=[\n
\'account_type/asset/receivable\',\n
\'account_type/liability/payable\', ],\n
group_by_mirror_section=1,\n
group_by_node=1,\n
from_date=from_date,\n
at_date=from_date + 1,\n
portal_type=balance_movement_type_list,\n
**inventory_params):\n
mirror_section_uid = MARKER\n
if expand_accounts:\n
mirror_section_key = node[\'mirror_section_uid\']\n
account_props = line_per_account.setdefault(\n
(node[\'node_relative_url\'], mirror_section_key, MARKER),\n
dict(debit=0, credit=0))\n
total_price = node[\'total_price\'] or 0\n
account_props[\'initial_debit_balance\'] = account_props.get(\n
\'initial_debit_balance\', 0) + max(total_price, 0)\n
account_props[\'initial_credit_balance\'] = account_props.get(\n
\'initial_credit_balance\', 0) + max(- total_price, 0)\n
\n
for node in getInventoryList(\n
node_category_strict_membership=\n
......@@ -458,8 +489,11 @@ if account_type_to_group_by_mirror_section:\n
to_date=from_date,\n
portal_type=accounting_movement_type_list,\n
**inventory_params):\n
mirror_section_uid = MARKER\n
if expand_accounts:\n
mirror_section_key = node[\'mirror_section_uid\']\n
account_props = line_per_account.setdefault(\n
(node[\'node_relative_url\'], node[\'mirror_section_uid\'], MARKER),\n
(node[\'node_relative_url\'], mirror_section_key, MARKER),\n
dict(debit=0, credit=0))\n
total_price = node[\'total_price\'] or 0\n
account_props[\'initial_debit_balance\'] = account_props.get(\n
......@@ -475,8 +509,11 @@ if account_type_to_group_by_mirror_section:\n
to_date=from_date,\n
portal_type=accounting_movement_type_list,\n
**inventory_params):\n
mirror_section_uid = MARKER\n
if expand_accounts:\n
mirror_section_key = node[\'mirror_section_uid\']\n
account_props = line_per_account.setdefault(\n
(node[\'node_relative_url\'], node[\'mirror_section_uid\'], MARKER),\n
(node[\'node_relative_url\'], mirror_section_key, MARKER),\n
dict(debit=0, credit=0))\n
total_price = node[\'total_price\'] or 0\n
account_props[\'initial_credit_balance\'] = account_props.get(\n
......@@ -805,9 +842,10 @@ return new_line_list\n
<string>getNodeTitleAndId</string>
<string>initial_balance_date</string>
<string>min</string>
<string>mirror_section_uid</string>
<string>mirror_section_key</string>
<string>line_list</string>
<string>node_relative_url</string>
<string>mirror_section_uid</string>
<string>payment_uid</string>
<string>data</string>
<string>node_title</string>
......
487
\ No newline at end of file
488
\ No newline at end of file
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