Commit a6b4a697 authored by Jérome Perrin's avatar Jérome Perrin

Aged balance: do not load objects in summary mode

parent e369aa7d
...@@ -108,26 +108,31 @@ for brain in portal.portal_simulation.getMovementHistoryList(\n ...@@ -108,26 +108,31 @@ for brain in portal.portal_simulation.getMovementHistoryList(\n
total_price = brain.total_price\n total_price = brain.total_price\n
if account_type == \'account_type/liability/payable\':\n if account_type == \'account_type/liability/payable\':\n
total_price = - total_price\n total_price = - total_price\n
\n \n
line = Object(uid=\'new_\',\n line = Object(uid=\'new_\',\n
mirror_section_title=getSectionTitle(brain.mirror_section_uid),\n mirror_section_title=getSectionTitle(brain.mirror_section_uid),\n
mirror_section_uid=brain.mirror_section_uid,\n mirror_section_uid=brain.mirror_section_uid,\n
explanation_title=movement.hasTitle() and movement.getTitle()\n
or transaction.getTitle(),\n
reference=transaction.getReference(),\n
portal_type=transaction.getTranslatedPortalType(),\n
date=brain.date,\n
total_price=total_price,)\n total_price=total_price,)\n
\n \n
if brain.mirror_section_uid == movement.getSourceSectionUid():\n if detail:\n
  • For the records, this change was incomplete. The two lines from above:

       movement = brain.getObject()
       transaction = movement.getParentValue()

    should also have been in this if detail: branch because they also load the objects from ZODB.

Please register or sign in to reply
line[\'specific_reference\'] = transaction.getDestinationReference()\n # Detailed version of the aged balance report needs to get properties from\n
line[\'gap_id\'] = getAccountNumber(movement.getDestination())\n # the movement or transactions, but summary does not. This conditional is\n
else:\n # here so that we do not load objects when running in summary mode.\n
line[\'specific_reference\'] = transaction.getSourceReference()\n line[\'explanation_title\'] = movement.hasTitle() and movement.getTitle() or transaction.getTitle()\n
line[\'gap_id\'] = getAccountNumber(movement.getSource())\n line[\'reference\'] = transaction.getReference()\n
assert brain.mirror_section_uid == movement.getDestinationSectionUid()\n line[\'portal_type\'] = transaction.getTranslatedPortalType()\n
line[\'date\'] = brain.date\n
if brain.mirror_section_uid == movement.getSourceSectionUid():\n
line[\'specific_reference\'] = transaction.getDestinationReference()\n
line[\'gap_id\'] = getAccountNumber(movement.getDestination())\n
else:\n
line[\'specific_reference\'] = transaction.getSourceReference()\n
line[\'gap_id\'] = getAccountNumber(movement.getSource())\n
assert brain.mirror_section_uid == movement.getDestinationSectionUid()\n
\n \n
age = int(at_date - brain.date)\n # Note that we use date_utc because date would load the object and we are just\n
# interested in the difference of days.\n
age = int(at_date - brain.date_utc)\n
line[\'age\'] = age\n line[\'age\'] = age\n
if age < 0:\n if age < 0:\n
line[\'period_future\'] = total_price\n line[\'period_future\'] = total_price\n
...@@ -150,7 +155,7 @@ return line_list\n ...@@ -150,7 +155,7 @@ return line_list\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>at_date, section_category, section_category_strict, simulation_state, period_list, account_type, **kw</string> </value> <value> <string>at_date, section_category, section_category_strict, simulation_state, period_list, account_type, detail=True, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -57,7 +57,7 @@ line_list = []\n ...@@ -57,7 +57,7 @@ line_list = []\n
detail_line_list = portal\\\n detail_line_list = portal\\\n
.AccountingTransactionModule_getDetailedAgedBalanceLineList(\n .AccountingTransactionModule_getDetailedAgedBalanceLineList(\n
at_date, section_category, section_category_strict,\n at_date, section_category, section_category_strict,\n
simulation_state, period_list, account_type, **kw)\n simulation_state, period_list, account_type, detail=False, **kw)\n
\n \n
period_id_list = [\'period_future\']\n period_id_list = [\'period_future\']\n
for idx, period in enumerate(period_list):\n for idx, period in enumerate(period_list):\n
......
1556 1557
\ No newline at end of file \ 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