Commit e08f4519 authored by Aurel's avatar Aurel

optimization of report + some xml changes

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20706 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 338950d0
......@@ -289,7 +289,7 @@ WHERE\n
<dtml-call expr="row_list.append([uid[loop_item], uid_dict[uid[loop_item]], getBaobabSourceUid[loop_item], getBaobabSourceSectionUid[loop_item], getBaobabSourcePaymentUid[loop_item], getExplanationUid[loop_item], getBaobabDestinationSectionUid[loop_item], getBaobabDestinationUid[loop_item], getResourceUid[loop_item], -(getInventoriatedQuantity[loop_item] or 0), getStartDate[loop_item], getSourceInventoriatedTotalAssetPrice[loop_item], getPortalType[loop_item], getSimulationState[loop_item], getBaobabSourceVariationText[loop_item],getSubVariationText[loop_item]])">\n
</dtml-if>\n
</dtml-if>\n
</dtml-in> \n
</dtml-in>\n
\n
<dtml-if "row_list">\n
INSERT INTO\n
......@@ -299,8 +299,8 @@ VALUES\n
(\n
<dtml-sqlvar expr="row_item[0]" type="int">,\n
<dtml-sqlvar expr="row_item[1]" type="int">,\n
<dtml-sqlvar expr="row_item[2]" type="int">, \n
<dtml-sqlvar expr="row_item[3]" type="int" optional>, \n
<dtml-sqlvar expr="row_item[2]" type="int">,\n
<dtml-sqlvar expr="row_item[3]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[4]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[5]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[6]" type="int" optional>,\n
......@@ -380,7 +380,7 @@ WHERE\n
<dtml-call expr="row_list.append([uid[loop_item], uid_dict[uid[loop_item]], getBaobabSourceUid[loop_item], getBaobabSourceSectionUid[loop_item], getBaobabSourcePaymentUid[loop_item], getExplanationUid[loop_item], getBaobabDestinationSectionUid[loop_item], getBaobabDestinationUid[loop_item], getResourceUid[loop_item], -(getInventoriatedQuantity[loop_item] or 0), getStartDate[loop_item], getSourceInventoriatedTotalAssetPrice[loop_item], getPortalType[loop_item], getSimulationState[loop_item], getBaobabSourceVariationText[loop_item],getSubVariationText[loop_item]])">\n
</dtml-if>\n
</dtml-if>\n
</dtml-in> \n
</dtml-in>\n
\n
<dtml-if "row_list">\n
INSERT INTO\n
......@@ -390,8 +390,8 @@ VALUES\n
(\n
<dtml-sqlvar expr="row_item[0]" type="int">,\n
<dtml-sqlvar expr="row_item[1]" type="int">,\n
<dtml-sqlvar expr="row_item[2]" type="int">, \n
<dtml-sqlvar expr="row_item[3]" type="int" optional>, \n
<dtml-sqlvar expr="row_item[2]" type="int">,\n
<dtml-sqlvar expr="row_item[3]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[4]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[5]" type="int" optional>,\n
<dtml-sqlvar expr="row_item[6]" type="int" optional>,\n
......
......@@ -85,6 +85,9 @@ if len(account_list) == 0:\n
if len(account_list) == 0:\n
message = Message(domain="ui", message="No bank account have this reference")\n
raise ValueError, message\n
if force_one_account and len(account_list) != 1:\n
message = Message(domain="ui", message="More than one account match this research")\n
raise ValueError, message\n
\n
account_list = [x.getObject() for x in account_list]\n
\n
......@@ -121,7 +124,7 @@ return account_list\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>reference=None, total_price=0</string> </value>
<value> <string>reference=None, total_price=0, force_one_account=0</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......@@ -149,7 +152,7 @@ return account_list\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>2</int> </value>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -157,6 +160,7 @@ return account_list\n
<tuple>
<string>reference</string>
<string>total_price</string>
<string>force_one_account</string>
<string>Products.ERP5Type.Message</string>
<string>Message</string>
<string>None</string>
......@@ -193,6 +197,7 @@ return account_list\n
<tuple>
<none/>
<int>0</int>
<int>0</int>
</tuple>
</value>
</item>
......
......@@ -72,7 +72,8 @@ from Products.ERP5Type.Document import newTempBase\n
if reference is None:\n
account_list = [context]\n
else:\n
account_list = context.BankAccount_getReportInformationList(reference=reference)\n
account_list = context.BankAccount_getReportInformationList(reference=reference, \n
force_one_account=force_one_account)\n
\n
# Build the common inventory dict\n
params = {}\n
......@@ -225,7 +226,7 @@ return inv_account_dict.values()\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>from_date=None, at_date=None, reference=None, current_inventory=0, available_inventory=0, future_inventory=0, transaction_list=0</string> </value>
<value> <string>from_date=None, at_date=None, reference=None, current_inventory=0, available_inventory=0, future_inventory=0, transaction_list=0, force_one_account=0</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......@@ -253,7 +254,7 @@ return inv_account_dict.values()\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>7</int> </value>
<value> <int>8</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -266,6 +267,7 @@ return inv_account_dict.values()\n
<string>available_inventory</string>
<string>future_inventory</string>
<string>transaction_list</string>
<string>force_one_account</string>
<string>Products.ERP5Type.Document</string>
<string>newTempBase</string>
<string>None</string>
......@@ -323,6 +325,7 @@ return inv_account_dict.values()\n
<int>0</int>
<int>0</int>
<int>0</int>
<int>0</int>
</tuple>
</value>
</item>
......
......@@ -70,7 +70,7 @@
\n
orga_id = "site_%3s" %(site.getCodification())\n
org = context.organisation_module[orga_id]\n
\n
context.log(\'org\',org)\n
return org\n
</string> </value>
</item>
......
......@@ -67,17 +67,33 @@
<key> <string>_body</string> </key>
<value> <string>resource_dict = {}\n
resource_dict = {\'resource_relative_url\':resource, \'variation_text\':variation_text}\n
portal = context.getPortalObject()\n
\n
if cache_dict is None:\n
cache_dict = {}\n
cache_title_category_url = cache_dict.setdefault(\'cache_title_category_url\',{})\n
cache_translated_title_category_url = cache_dict.setdefault(\'cache_translated_title_category_url\',{})\n
cache_resource_portal_type = cache_dict.setdefault(\'cache_resource_portal_type\', {})\n
cache_resource = cache_dict.setdefault(\'cache_resource\', {})\n
cache_translated_portal_type = cache_dict.setdefault(\'cache_translated_portal_type\', {})\n
cache_translated_simulation_state = cache_dict.setdefault(\'cache_translated_simulation_state\', {})\n
\n
def getVariationTitleList(variation_text):\n
return [getTitleFromCategoryUrl(x) for x in variation_text.split(\'\\n\')]\n
\n
#def getVariationTitleList(variation_text):\n
# return [getTitleFromCategoryUrl(x) for x in variation_text.split(\'\\n\')]\n
\n
def getTitleFromCategoryUrl(category):\n
return context.portal_categories.getCategoryValue(category).getTitle()\n
result = cache_title_category_url.get(category, None)\n
if result is None:\n
result = context.portal_categories.getCategoryValue(category).getTitle()\n
cache_title_category_url[category] = result\n
return result\n
\n
def getTranslatedTitleFromCategoryUrl(category):\n
return context.portal_categories.getCategoryValue(category).getTranslatedTitle()\n
result = cache_translated_title_category_url.get(category, None)\n
if result is None:\n
result = context.portal_categories.getCategoryValue(category).getTranslatedTitle()\n
cache_translated_title_category_url[category] = result\n
return result\n
\n
\n
for variation in variation_text.split(\'\\n\'):\n
......@@ -94,37 +110,71 @@ for variation in variation_text.split(\'\\n\'):\n
resource_dict[\'variation_title\'] = getTitleFromCategoryUrl(variation)\n
resource_dict[\'variation_translated_title\'] = getTranslatedTitleFromCategoryUrl(variation)\n
\n
resource_dict[\'variation_text_title\'] = \' \'.join(getVariationTitleList(resource))\n
#resource_dict[\'variation_text_title\'] = \' \'.join(getVariationTitleList(resource))\n
\n
\n
resource_value = portal.restrictedTraverse(resource)\n
current_resource_portal_type = resource_value.getPortalType()\n
current_resource_portal_type = cache_resource_portal_type.get(resource, None)\n
if current_resource_portal_type is None:\n
portal = context.getPortalObject()\n
resource_value = portal.restrictedTraverse(resource)\n
current_resource_portal_type = resource_value.getPortalType()\n
cache_resource_portal_type[resource] = current_resource_portal_type\n
resource_info_dict = {}\n
resource_info_dict[\'base_price\'] = resource_value.getBasePrice()\n
resource_info_dict[\'resource_title\'] = resource_value.getTitle()\n
resource_info_dict[\'resource_id\'] = resource_value.getId()\n
#context.log(\'resource_value\',resource_value.getRelativeUrl())\n
try:\n
resource_info_dict[\'resource_translated_title\'] = resource_value.getTranslatedTitle()\n
except KeyError:\n
resource_info_dict[\'resource_translated_title\'] = resource_value.getTitle()\n
resource_info_dict[\'price_currency_title\'] = resource_value.getPriceCurrencyTitle()\n
resource_info_dict[\'price_currency_id\'] = resource_value.getPriceCurrencyId()\n
resource_info_dict[\'price_currency\'] = resource_value.getPriceCurrency()\n
resource_info_dict[\'resource_portal_type\'] = current_resource_portal_type\n
cache_resource[resource] = resource_info_dict\n
\n
# Should not be None\n
resource_dict.update(cache_resource.get(resource))\n
\n
##############\n
#movement =None\n
#resource_dict[\'explanation_translated_relative_url\'] = \'xx\'\n
###########\n
if movement is not None: # case of history\n
#context.log(\'movement uid before error\',resource[2])\n
#movement = context.portal_catalog.getObject(resource[2])\n
movement = portal.restrictedTraverse(movement)\n
#context.log(\'CounterModule_getVaultTransactionList\', \'movement = %s\' %movement)\n
explanation_value = movement\n
if getattr(movement,\'getExplanationValue\',None) is not None:\n
explanation_value = movement.getExplanationValue()\n
resource_dict[\'explanation_relative_url\'] = explanation_value.getRelativeUrl()\n
source_reference = explanation_value.getSourceReference() or \'\'\n
resource_dict[\'source_reference\'] = source_reference\n
# movement = portal.restrictedTraverse(movement)\n
# explanation_value = movement\n
# if getattr(movement,\'getExplanationValue\',None) is not None:\n
# explanation_value = movement.getExplanationValue()\n
# resource_dict[\'explanation_relative_url\'] = explanation_value.getRelativeUrl()\n
# source_reference = explanation_value.getSourceReference() or \'\'\n
# resource_dict[\'source_reference\'] = source_reference\n
# if display_simulation_state:\n
# resource_dict[\'simulation_state_title\'] = movement.getTranslatedSimulationStateTitle()\n
# resource_dict[\'explanation_translated_relative_url\'] = "%s/%s" % \\\n
# (explanation_value.getTranslatedPortalType(),source_reference)\n
# context.log("explanation_uid", explanation_uid)\n
catalog_explanation = cache_dict[\'cache_explanation\'][explanation_uid]\n
# context.log("explanation_uid url", catalog_explanation.relative_url)\n
resource_dict[\'explanation_relative_url\'] = catalog_explanation.relative_url\n
source_reference = catalog_explanation.source_reference\n
resource_dict[\'source_reference\'] = catalog_explanation.source_reference\n
explanation_portal_type = catalog_explanation.portal_type\n
if display_simulation_state:\n
resource_dict[\'simulation_state_title\'] = movement.getTranslatedSimulationStateTitle()\n
resource_dict[\'explanation_translated_relative_url\'] = "%s/%s" % \\\n
(explanation_value.getTranslatedPortalType(),source_reference)\n
resource_dict[\'base_price\'] = resource_value.getBasePrice()\n
resource_dict[\'resource_title\'] = resource_value.getTitle()\n
resource_dict[\'resource_id\'] = resource_value.getId()\n
#context.log(\'resource_value\',resource_value.getRelativeUrl())\n
try:\n
resource_dict[\'resource_translated_title\'] = resource_value.getTranslatedTitle()\n
except KeyError:\n
resource_dict[\'resource_translated_title\'] = resource_value.getTitle()\n
resource_dict[\'price_currency_title\'] = resource_value.getPriceCurrencyTitle()\n
resource_dict[\'price_currency_id\'] = resource_value.getPriceCurrencyId()\n
resource_dict[\'price_currency\'] = resource_value.getPriceCurrency()\n
resource_dict[\'resource_portal_type\'] = current_resource_portal_type\n
simulation_state = catalog_explanation.simulation_state\n
simulation_state_title = cache_translated_simulation_state.get((explanation_portal_type,simulation_state), None)\n
if simulation_state_title is None:\n
portal = context.getPortalObject()\n
movement = portal.restrictedTraverse(movement)\n
simulation_state_title = movement.getTranslatedSimulationStateTitle()\n
cache_translated_simulation_state[(explanation_portal_type,simulation_state)] = simulation_state_title\n
resource_dict[\'simulation_state_title\'] = simulation_state_title\n
translated_portal_type = cache_translated_portal_type.get(explanation_portal_type, None)\n
if translated_portal_type is None:\n
translated_portal_type = context.Base_translateString(explanation_portal_type)\n
cache_translated_portal_type[explanation_portal_type] = translated_portal_type\n
resource_dict[\'explanation_translated_relative_url\'] = \'%s/%s\' % \\\n
(translated_portal_type, source_reference)\n
\n
\n
\n
......@@ -151,7 +201,7 @@ return resource_dict\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>resource, variation_text, movement=None, display_simulation_state=0</string> </value>
<value> <string>resource, variation_text, movement=None, display_simulation_state=0, explanation_uid=None, cache_dict=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......@@ -179,7 +229,7 @@ return resource_dict\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>4</int> </value>
<value> <int>6</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -189,23 +239,35 @@ return resource_dict\n
<string>variation_text</string>
<string>movement</string>
<string>display_simulation_state</string>
<string>explanation_uid</string>
<string>cache_dict</string>
<string>resource_dict</string>
<string>None</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>cache_title_category_url</string>
<string>cache_translated_title_category_url</string>
<string>cache_resource_portal_type</string>
<string>cache_resource</string>
<string>cache_translated_portal_type</string>
<string>cache_translated_simulation_state</string>
<string>getTitleFromCategoryUrl</string>
<string>getVariationTitleList</string>
<string>getTranslatedTitleFromCategoryUrl</string>
<string>_getiter_</string>
<string>variation</string>
<string>_write_</string>
<string>resource_value</string>
<string>current_resource_portal_type</string>
<string>None</string>
<string>explanation_value</string>
<string>getattr</string>
<string>source_reference</string>
<string>context</string>
<string>portal</string>
<string>resource_value</string>
<string>resource_info_dict</string>
<string>KeyError</string>
<string>_getitem_</string>
<string>catalog_explanation</string>
<string>source_reference</string>
<string>explanation_portal_type</string>
<string>simulation_state</string>
<string>simulation_state_title</string>
<string>translated_portal_type</string>
</tuple>
</value>
</item>
......@@ -220,6 +282,8 @@ return resource_dict\n
<tuple>
<none/>
<int>0</int>
<none/>
<none/>
</tuple>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="SQL" module="Products.ZSQLMethods.SQL"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_arg</string> </key>
<value>
<object>
<klass>
<global name="Args" module="Shared.DC.ZRDB.Aqueduct"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_data</string> </key>
<value>
<dictionary>
<item>
<key> <string>uid_list</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>_keys</string> </key>
<value>
<list>
<string>uid_list</string>
</list>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>allow_simple_one_argument_traversal</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>uid_list</string> </value>
</item>
<item>
<key> <string>cache_time_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>class_file_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_zGetAllFromCatalog</string> </value>
</item>
<item>
<key> <string>max_cache_</string> </key>
<value> <int>100</int> </value>
</item>
<item>
<key> <string>max_rows_</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
select \n
*\n
\n
FROM catalog\n
WHERE \n
1=1\n
AND (\n
<dtml-in uid_list>\n
uid = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if>\n
</dtml-in>)
]]></string> </value>
</item>
<item>
<key> <string>template</string> </key>
<value>
<object>
<klass>
<global name="__newobj__" module="copy_reg"/>
</klass>
<tuple>
<global name="SQL" module="Shared.DC.ZRDB.DA"/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string encoding="cdata"><![CDATA[
<string>
]]></string> </value>
</item>
<item>
<key> <string>_vars</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>globals</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>raw</string> </key>
<value> <string encoding="cdata"><![CDATA[
select \n
*\n
\n
FROM catalog\n
WHERE \n
1=1\n
AND (\n
<dtml-in uid_list>\n
uid = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if>\n
</dtml-in>)
]]></string> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -82,7 +82,7 @@
return result\n
\n
# Last, compare the variations (such as the years 1994 and 2003).\n
result = cmp(a.variation_text_title, b.variation_text_title)\n
result = cmp(a.cash_status_title, b.cash_status_title)\n
if result != 0:\n
return result\n
\n
......
......@@ -77,6 +77,8 @@
#\n
\n
from Products.ERP5Type.Document import newTempBase\n
from DateTime import DateTime\n
begin = DateTime()\n
\n
if from_date is not None:\n
if from_date == at_date:\n
......@@ -85,17 +87,9 @@ if from_date is not None:\n
if only_last_date and vault_report_type==\'history\':\n
from_date = at_date\n
\n
#context.log(\'CounterModule_getVaultTransactionList vault:\',vault)\n
def getTranslatedTitleFromCategoryUrl(category):\n
return context.portal_categories.getCategoryValue(category).getTranslatedTitle()\n
\n
def getTitleFromCategoryUrl(category):\n
return context.portal_categories.getCategoryValue(category).getTitle()\n
\n
def getVariationTitleList(variation_text):\n
return [getTitleFromCategoryUrl(x) for x in variation_text.split(\'\\n\')]\n
\n
\n
resource_dict = {}\n
vault_dict = {}\n
vault_inventory_dict = {}\n
......@@ -199,6 +193,8 @@ if column_names == 1:\n
column_list.append((\'general_total_price\', \'General TotalPrice\'))\n
return column_list\n
\n
end = DateTime()\n
context.log(\'before sql time:\',(end-begin)*86400)\n
#context.log(\'node_category\',vault)\n
#context.log(\'inventory_kw\',inventory_kw)\n
display_simulation_state = 0\n
......@@ -217,6 +213,8 @@ else: \n
# , ignore_variation=0,src__=1\n
# ,**inventory_kw\n
# ))\n
end = DateTime()\n
context.log(\'sql request time:\',(end-begin)*86400)\n
\n
if summarise:\n
total_quantity = 0\n
......@@ -230,6 +228,8 @@ if summarise:\n
total_price += vault_inventory.total_price\n
return [newTempBase(context, "summary", total_quantity=total_quantity, total_price=total_price), ]\n
\n
explanation_uid_list = []\n
\n
#context.log(\'len(vault_inventory_list:\',len(vault_inventory_list))\n
for vault_inventory in vault_inventory_list:\n
node_relative_url = vault_inventory.node_relative_url\n
......@@ -249,7 +249,10 @@ for vault_inventory in vault_inventory_list:\n
resource = (vault_inventory.resource_relative_url, variation_text)\n
if vault_report_type==\'history\':\n
#resource = (vault_inventory.resource_relative_url, vault_inventory.variation_text or \'\',vault_inventory.stock_uid)\n
resource = (vault_inventory.resource_relative_url, variation_text, vault_inventory.path)\n
explanation_uid = vault_inventory.explanation_uid\n
explanation_uid_list.append(explanation_uid)\n
resource = (vault_inventory.resource_relative_url, variation_text, explanation_uid,\n
vault_inventory.path)\n
if not vault_inventory_dict[node_relative_url].has_key(resource):\n
total_quantity = vault_inventory.total_quantity\n
if total_quantity is None:\n
......@@ -268,27 +271,51 @@ for vault_inventory in vault_inventory_list:\n
resource_dict[resource] = 1\n
\n
\n
end = DateTime()\n
context.log(\'after first big loop:\',(end-begin)*86400)\n
\n
#context.log(\'resource_dict\',resource_dict)\n
#context.log(\'vault_inventory_dict\',vault_inventory_dict)\n
cache_dict = {}\n
cache_dict[\'cache_explanation\'] = {}\n
\n
if vault_report_type == \'history\':\n
if len(explanation_uid_list) > 0:\n
# context.log("getAllFromCatalog, expla uid", explanation_uid_list)\n
catalog_result_list = context.Base_zGetAllFromCatalog(uid_list=explanation_uid_list)\n
# context.log("getAllFromCatalog", context.Base_zGetAllFromCatalog(uid_list=explanation_uid_list, src__=1))\n
for line in catalog_result_list:\n
cache_dict[\'cache_explanation\'][line.uid] = line\n
\n
end = DateTime()\n
context.log(\'after getting data into catalog:\',(end-begin)*86400)\n
i = 0\n
#for resource in context.Baobab_sortResourceTitleList(resource_dict.keys()):\n
resource_portal_type_cache_dict = {}\n
for resource in resource_dict.keys():\n
movement = None\n
if len(resource)==3: # case of history\n
explanation_uid = None\n
if len(resource)==4: # case of history\n
#context.log(\'movement uid before error\',resource[2])\n
#movement = context.portal_catalog.getObject(resource[2])\n
movement = resource[2]\n
explanation_uid = resource[2]\n
movement = resource[3]\n
resource_url = resource[0]\n
resource_value = portal.restrictedTraverse(resource_url)\n
current_resource_portal_type = resource_value.getPortalType()\n
current_resource_portal_type = resource_portal_type_cache_dict.get(resource_url, None)\n
if current_resource_portal_type is None:\n
resource_value = portal.restrictedTraverse(resource_url)\n
current_resource_portal_type = resource_value.getPortalType()\n
resource_portal_type_cache_dict[resource_url] = current_resource_portal_type\n
if current_resource_portal_type not in resource_portal_type:\n
continue\n
variation_text = resource[1]\n
tmp_dict = context.Base_getResourceInformationDictFromUrlAndVariation(\n
resource_url, variation_text, movement=movement, \n
display_simulation_state= display_simulation_state)\n
display_simulation_state= display_simulation_state,\n
explanation_uid=explanation_uid,\n
cache_dict=cache_dict)\n
#tmp_dict = {}\n
#context.log("resource %s" %(resource,), "tmp_dict %s" %(tmp_dict[\'explanation_relative_url\'],))\n
general_total_price = 0\n
for vault in vault_dict.keys():\n
try:\n
......@@ -311,13 +338,19 @@ for resource in resource_dict.keys():\n
tmp_dict.update({\'date\':resource_in_vault[\'date\']})\n
general_total_price += resource_in_vault[\'total_price\']\n
tmp_dict[\'general_total_price\'] = general_total_price\n
# temp_base = newTempBase(context, "new_%03i" % i)\n
# temp_base = temp_base.asContext(**tmp_dict)\n
# total_inventory_list.append(temp_base)\n
total_inventory_list.append(newTempBase(context, "new_%03i" % i, **tmp_dict))\n
i += 1\n
\n
end = DateTime()\n
context.log(\'after second big loop:\',(end-begin)*86400)\n
\n
def sort_base_price(a,b):\n
return -cmp(a.base_price,b.base_price)\n
\n
total_inventory_list.sort(sort_base_price)\n
#total_inventory_list.sort(sort_base_price)\n
\n
return total_inventory_list\n
\n
......@@ -396,10 +429,10 @@ return repr([x for x in total_inventory_list])\n
<string>kw</string>
<string>Products.ERP5Type.Document</string>
<string>newTempBase</string>
<string>DateTime</string>
<string>begin</string>
<string>None</string>
<string>getTranslatedTitleFromCategoryUrl</string>
<string>getTitleFromCategoryUrl</string>
<string>getVariationTitleList</string>
<string>resource_dict</string>
<string>vault_dict</string>
<string>vault_inventory_dict</string>
......@@ -432,6 +465,7 @@ return repr([x for x in total_inventory_list])\n
<string>variation</string>
<string>variation_text</string>
<string>column_list</string>
<string>end</string>
<string>display_simulation_state</string>
<string>_apply_</string>
<string>vault_inventory_list</string>
......@@ -440,15 +474,21 @@ return repr([x for x in total_inventory_list])\n
<string>vault_inventory</string>
<string>_inplacevar_</string>
<string>abs</string>
<string>explanation_uid_list</string>
<string>node_relative_url</string>
<string>must_continue</string>
<string>excluded_variation</string>
<string>resource</string>
<string>explanation_uid</string>
<string>cache_dict</string>
<string>catalog_result_list</string>
<string>line</string>
<string>i</string>
<string>resource_portal_type_cache_dict</string>
<string>movement</string>
<string>resource_url</string>
<string>resource_value</string>
<string>current_resource_portal_type</string>
<string>resource_value</string>
<string>tmp_dict</string>
<string>general_total_price</string>
<string>resource_in_vault</string>
......
......@@ -448,7 +448,7 @@
</item>
<item>
<key> <string>lines</string> </key>
<value> <int>30</int> </value>
<value> <int>1000</int> </value>
</item>
<item>
<key> <string>list_action</string> </key>
......
433
\ No newline at end of file
434
\ 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