Commit 64d9500c authored by Jérome Perrin's avatar Jérome Perrin

remove all source_ to be side independant


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5609 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3ade3d36
...@@ -83,7 +83,6 @@ display_categories = request.get(\'display_categories\', 0)\n ...@@ -83,7 +83,6 @@ display_categories = request.get(\'display_categories\', 0)\n
# TODO\n # TODO\n
omit_grouping_reference = request.get(\'omit_grouping_reference\', 0)\n omit_grouping_reference = request.get(\'omit_grouping_reference\', 0)\n
\n \n
\n
params = {\n params = {\n
\'at_date\' : at_date,\n \'at_date\' : at_date,\n
\'section_category\' : transaction_section_category,\n \'section_category\' : transaction_section_category,\n
...@@ -108,7 +107,7 @@ if from_date:\n ...@@ -108,7 +107,7 @@ if from_date:\n
params[\'from_date\'] = from_date\n params[\'from_date\'] = from_date\n
preferences[\'preferred_accounting_transaction_from_date\'] = from_date\n preferences[\'preferred_accounting_transaction_from_date\'] = from_date\n
\n \n
## FIXME: issue in reporting famework in ERP5 \n ## FIXME: issue in reporting famework in ERP5 ? \n
from Products.ERP5Type.Cache import clearCache\n from Products.ERP5Type.Cache import clearCache\n
clearCache() # for preferences\n clearCache() # for preferences\n
\n \n
...@@ -116,14 +115,14 @@ result = []\n ...@@ -116,14 +115,14 @@ result = []\n
portal = context.portal_url.getPortalObject()\n portal = context.portal_url.getPortalObject()\n
\n \n
account_columns = (\n account_columns = (\n
(\'source_reference\', \'Reference\'),\n (\'specific_reference\', \'Reference\'),\n
(\'delivery.start_date\', \'Date\'),\n (\'delivery.start_date\', \'Date\'),\n
(\'title\', \'Title\'),\n (\'title\', \'Title\'),\n
(\'translated_portal_type\', \'Type\'),\n (\'translated_portal_type\', \'Type\'),\n
(\'third_party\', \'Third Party\'),\n (\'third_party\', \'Third Party\'),\n
(\'translated_simulation_state_title\', \'State\'),\n (\'translated_simulation_state_title\', \'State\'),\n
(\'source_debit\', \'Debit\'),\n (\'debit\', \'Debit\'),\n
(\'source_credit\', \'Credit\'),\n (\'credit\', \'Credit\'),\n
(\'net_balance\', \'Balance\'),\n (\'net_balance\', \'Balance\'),\n
)\n )\n
\n \n
...@@ -132,7 +131,8 @@ if gap :\n ...@@ -132,7 +131,8 @@ if gap :\n
portal.portal_categories.gap.restrictedTraverse(gap)\\\n portal.portal_categories.gap.restrictedTraverse(gap)\\\n
.Category_getSortedCategoryChildValueList()\n .Category_getSortedCategoryChildValueList()\n
else :\n else :\n
cat = \'gap/%s\'%context.portal_preferences.getPreferredAccountingTransactionGap() \\\n cat = \'gap/%s\'%context.portal_preferences\\\n
.getPreferredAccountingTransactionGap()\\\n
or context.getPortalDefaultGapRoot()\n or context.getPortalDefaultGapRoot()\n
\n \n
gap_value_list = portal.portal_categories.resolveCategory(cat)\\\n gap_value_list = portal.portal_categories.resolveCategory(cat)\\\n
...@@ -157,11 +157,9 @@ for c in gap_value_list :\n ...@@ -157,11 +157,9 @@ for c in gap_value_list :\n
account_inventory_list_cache[account.getUid()] = len(portal.\\\n account_inventory_list_cache[account.getUid()] = len(portal.\\\n
portal_simulation.getInventoryList( omit_simulation = 1,\n portal_simulation.getInventoryList( omit_simulation = 1,\n
node_uid = account.getUid(), **account_inventory_list_cache_params))\n node_uid = account.getUid(), **account_inventory_list_cache_params))\n
\n
if account_inventory_list_cache[account.getUid()] != 0 :\n if account_inventory_list_cache[account.getUid()] != 0 :\n
skip_branch = 0\n skip_branch = 0\n
\n \n
\n
if skip_branch :\n if skip_branch :\n
continue\n continue\n
\n \n
...@@ -177,19 +175,18 @@ for c in gap_value_list :\n ...@@ -177,19 +175,18 @@ for c in gap_value_list :\n
if len(strict_account_list):\n if len(strict_account_list):\n
for account in strict_account_list:\n for account in strict_account_list:\n
if account.getAccountTypeId() in (\'payable\', \'receivable\') :\n if account.getAccountTypeId() in (\'payable\', \'receivable\') :\n
for third_party_path in account.Account_getDestinationSectionList(\n for third_party_brain in context.Account_zDistinctSectionList(\n
at_date = at_date,\n at_date = at_date,\n
simulation_state = transaction_simulation_state ) :\n simulation_state = transaction_simulation_state ) :\n
third_party_params = params.copy()\n third_party_params = params.copy()\n
if third_party_path is not None :\n third_party_params[\'mirror_section_uid\'] = third_party_brain.uid\n
third_party = context.getPortalObject().restrictedTraverse(third_party_path)\n
third_party_params[\'destination_section_uid\'] = third_party.getUid()\n
title = "%s: %s (%s)" % ( c.getId(),\n title = "%s: %s (%s)" % ( c.getId(),\n
account.getTitle(),\n account.getTitle(),\n
third_party.getTitle())\n third_party_brain.title )\n
else :\n if len(portal.portal_simulation.getInventoryList(\n
third_party_params[\'no_destination_section_uid\'] = 1\n mirror_section_uid = third_party_brain.uid,\n
title = "%s: %s" % ( c.getId(), account.getTitle())\n node_uid = account.getUid(),\n
**account_inventory_list_cache_params )):\n
result.append(ReportSection(\n result.append(ReportSection(\n
path = account.getPhysicalPath(),\n path = account.getPhysicalPath(),\n
title = title,\n title = title,\n
...@@ -204,17 +201,23 @@ for c in gap_value_list :\n ...@@ -204,17 +201,23 @@ for c in gap_value_list :\n
\n \n
elif account.getAccountTypeId() in (\'bank\', \'cash\') :\n elif account.getAccountTypeId() in (\'bank\', \'cash\') :\n
# Bank Account\n # Bank Account\n
for bank_account_path in account.Account_getSourcePaymentList() :\n for bank_account_brain in account.Account_zGetDistinctPaymentList(\n
at_date = at_date,\n
simulation_state = transaction_simulation_state ) :\n
bank_params = params.copy()\n bank_params = params.copy()\n
if bank_account_path is not None :\n if bank_account_brain.path is not None :\n
bank_account = context.getPortalObject().restrictedTraverse(bank_account_path)\n bank_params[\'payment_uid\'] = bank_account_brain.uid\n
bank_params[\'source_payment_uid\'] = bank_account.getUid()\n
title = "%s: %s (%s)" % ( c.getId(),\n title = "%s: %s (%s)" % ( c.getId(),\n
account.getTitle(),\n account.getTitle(),\n
bank_account.getTitle())\n bank_account_brain.title )\n
else :\n else :\n
bank_params[\'no_source_payment_uid\'] = 1\n bank_params[\'no_payment_uid\'] = 1\n
title = "%s: %s" % ( c.getId(), account.getTitle())\n title = "%s: %s" % ( c.getId(), account.getTitle())\n
\n
if len(portal.portal_simulation.getInventoryList(\n
payment_uid = bank_account_brain.uid,\n
node_uid = account.getUid(),\n
**account_inventory_list_cache_params )):\n
result.append(ReportSection(\n result.append(ReportSection(\n
path = account.getPhysicalPath(),\n path = account.getPhysicalPath(),\n
title = title,\n title = title,\n
...@@ -258,7 +261,7 @@ return result\n ...@@ -258,7 +261,7 @@ return result\n
</item> </item>
<item> <item>
<key> <string>_filepath</string> </key> <key> <string>_filepath</string> </key>
<value> <string>Script (Python):/nexedi/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList</string> </value> <value> <string>Script (Python):/erp5/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList</string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
...@@ -323,13 +326,11 @@ return result\n ...@@ -323,13 +326,11 @@ return result\n
<string>account</string> <string>account</string>
<string>len</string> <string>len</string>
<string>_apply_</string> <string>_apply_</string>
<string>third_party_path</string> <string>third_party_brain</string>
<string>third_party_params</string> <string>third_party_params</string>
<string>third_party</string>
<string>title</string> <string>title</string>
<string>bank_account_path</string> <string>bank_account_brain</string>
<string>bank_params</string> <string>bank_params</string>
<string>bank_account</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -66,24 +66,31 @@ ...@@ -66,24 +66,31 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>params = {}\n <value> <string>kw.update(selection.getParams())\n
params = {}\n
if kw.has_key(\'where_expression\'):\n if kw.has_key(\'where_expression\'):\n
params[\'where_expression\'] = kw[\'where_expression\']\n params[\'where_expression\'] = kw[\'where_expression\']\n
if kw.get(\'resource\'):\n if kw.get(\'resource\'):\n
try: params[\'resource_uid\'] = context.restritedTraverse(selection_params[\'resource\']).getUid()\n try: params[\'resource_uid\'] = context.restritedTraverse(\n
selection_params[\'resource\']).getUid()\n
except (KeyError, AttributeError): pass\n except (KeyError, AttributeError): pass\n
\n \n
# read settings from user preference\n # read settings from user preference\n
preference = context.getPortalObject().portal_preferences\n preference = context.getPortalObject().portal_preferences\n
from_date = kw.get(\'from_date\', preference.getPreferredAccountingTransactionFromDate())\n from_date = kw.get(\'from_date\',\n
preference.getPreferredAccountingTransactionFromDate())\n
if from_date :\n if from_date :\n
params[\'from_date\'] = from_date\n params[\'from_date\'] = from_date\n
at_date = kw.get(\'at_date\', preference.getPreferredAccountingTransactionAtDate())\n at_date = kw.get(\'at_date\',\n
preference.getPreferredAccountingTransactionAtDate())\n
if at_date :\n if at_date :\n
params[\'at_date\'] = at_date\n params[\'at_date\'] = at_date\n
simulation_state = preference.getPreferredAccountingTransactionSimulationStateList()\n \n
simulation_state = preference\\\n
.getPreferredAccountingTransactionSimulationStateList()\n
if simulation_state :\n if simulation_state :\n
params[\'transaction_simulation_state\'] = simulation_state\n params[\'transaction_simulation_state\'] = simulation_state\n
\n
section_category = preference.getPreferredAccountingTransactionSectionCategory()\n section_category = preference.getPreferredAccountingTransactionSectionCategory()\n
if section_category :\n if section_category :\n
params[\'transaction_section_category\'] = section_category\n params[\'transaction_section_category\'] = section_category\n
...@@ -95,19 +102,19 @@ if kw.get(\'omit_output\') :\n ...@@ -95,19 +102,19 @@ if kw.get(\'omit_output\') :\n
\n \n
MARKER = []\n MARKER = []\n
kw = selection.getParams()\n kw = selection.getParams()\n
source_payment_uid = kw.get(\'source_payment_uid\', MARKER)\n payment_uid = kw.get(\'payment_uid\', MARKER)\n
if source_payment_uid is not MARKER:\n if payment_uid is not MARKER:\n
params[\'source_payment_uid\'] = source_payment_uid\n params[\'payment_uid\'] = payment_uid\n
no_source_payment = kw.get(\'no_source_payment_uid\', MARKER)\n no_payment = kw.get(\'no_payment_uid\', MARKER)\n
if no_source_payment is not MARKER:\n if no_payment is not MARKER:\n
params[\'no_source_payment_uid\'] = 1\n params[\'no_payment_uid\'] = 1\n
\n \n
destination_section_uid = kw.get(\'destination_section_uid\', MARKER)\n mirror_section_uid = kw.get(\'mirror_section_uid\', MARKER)\n
if destination_section_uid is not MARKER:\n if mirror_section_uid is not MARKER:\n
params[\'destination_section_uid\'] = destination_section_uid\n params[\'mirror_section_uid\'] = mirror_section_uid\n
no_destination_section = kw.get(\'no_destination_section\', MARKER)\n no_mirror_section = kw.get(\'no_mirror_section\', MARKER)\n
if no_destination_section is not MARKER:\n if no_mirror_section is not MARKER:\n
params[\'no_destination_section\'] = 1\n params[\'no_mirror_section\'] = 1\n
\n \n
params[\'node_uid\'] = kw.get(\'node_uid\', context.getUid())\n params[\'node_uid\'] = kw.get(\'node_uid\', context.getUid())\n
\n \n
...@@ -118,7 +125,7 @@ if kw.get(\'from_date_summary\', 0) :\n ...@@ -118,7 +125,7 @@ if kw.get(\'from_date_summary\', 0) :\n
#context.log("SQL with %s \\n" % params, context.Account_zGetTotalQuantity(src__=1, **params))\n #context.log("SQL with %s \\n" % params, context.Account_zGetTotalQuantity(src__=1, **params))\n
result = context.Account_zGetTotalQuantity(**params)\n result = context.Account_zGetTotalQuantity(**params)\n
row = result[0]\n row = result[0]\n
return float(\'%.02f\' % (row.quantity or 0.0) )\n return float(\'%.02f\' % (row.total_price or 0.0) )\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -135,7 +142,7 @@ return float(\'%.02f\' % (row.quantity or 0.0) )\n ...@@ -135,7 +142,7 @@ return float(\'%.02f\' % (row.quantity or 0.0) )\n
</item> </item>
<item> <item>
<key> <string>_filepath</string> </key> <key> <string>_filepath</string> </key>
<value> <string>Script (Python):/nexedi/portal_skins/erp5_accounting/Account_statSourceBalance</string> </value> <value> <string>Script (Python):/erp5/portal_skins/erp5_accounting/Account_statSourceBalance</string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
...@@ -175,8 +182,8 @@ return float(\'%.02f\' % (row.quantity or 0.0) )\n ...@@ -175,8 +182,8 @@ return float(\'%.02f\' % (row.quantity or 0.0) )\n
<tuple> <tuple>
<string>selection</string> <string>selection</string>
<string>kw</string> <string>kw</string>
<string>params</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>params</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>_write_</string> <string>_write_</string>
<string>context</string> <string>context</string>
...@@ -189,10 +196,10 @@ return float(\'%.02f\' % (row.quantity or 0.0) )\n ...@@ -189,10 +196,10 @@ return float(\'%.02f\' % (row.quantity or 0.0) )\n
<string>simulation_state</string> <string>simulation_state</string>
<string>section_category</string> <string>section_category</string>
<string>MARKER</string> <string>MARKER</string>
<string>source_payment_uid</string> <string>payment_uid</string>
<string>no_source_payment</string> <string>no_payment</string>
<string>destination_section_uid</string> <string>mirror_section_uid</string>
<string>no_destination_section</string> <string>no_mirror_section</string>
<string>_apply_</string> <string>_apply_</string>
<string>result</string> <string>result</string>
<string>row</string> <string>row</string>
......
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