Commit 904640ce authored by Yusei Tahara's avatar Yusei Tahara

Optimize listbox when delivery_mirror_section_title is entered.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19535 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8b5f9b25
......@@ -672,7 +672,10 @@ destination_section_where_expression</string> </value>
</dtml-if>\n
</dtml-let>\n
</dtml-if>\n
<dtml-if delivery_mirror_section_title>, mirror_section_catalog.title as delivery_mirror_section_title</dtml-if>\n
<dtml-if delivery_mirror_section_title>\n
, mirror_section_catalog.title as delivery_mirror_section_title\n
, mirror_section_catalog.path as delivery_mirror_section_path\n
</dtml-if>\n
<dtml-if select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n
\n
......@@ -861,7 +864,10 @@ UNION\n
</dtml-if>\n
</dtml-let>\n
</dtml-if>\n
<dtml-if delivery_mirror_section_title>, mirror_section_catalog.title as delivery_mirror_section_title</dtml-if>\n
<dtml-if delivery_mirror_section_title>\n
, mirror_section_catalog.title as delivery_mirror_section_title\n
, mirror_section_catalog.path as delivery_mirror_section_path\n
</dtml-if>\n
<dtml-if select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n
\n
......@@ -1327,7 +1333,10 @@ UNION\n
</dtml-if>\n
</dtml-let>\n
</dtml-if>\n
<dtml-if delivery_mirror_section_title>, mirror_section_catalog.title as delivery_mirror_section_title</dtml-if>\n
<dtml-if delivery_mirror_section_title>\n
, mirror_section_catalog.title as delivery_mirror_section_title\n
, mirror_section_catalog.path as delivery_mirror_section_path\n
</dtml-if>\n
<dtml-if select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n
\n
......@@ -1516,7 +1525,10 @@ UNION\n
</dtml-if>\n
</dtml-let>\n
</dtml-if>\n
<dtml-if delivery_mirror_section_title>, mirror_section_catalog.title as delivery_mirror_section_title</dtml-if>\n
<dtml-if delivery_mirror_section_title>\n
, mirror_section_catalog.title as delivery_mirror_section_title\n
, mirror_section_catalog.path as delivery_mirror_section_path\n
</dtml-if>\n
<dtml-if select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n
\n
......
......@@ -66,14 +66,30 @@
<item>
<key> <string>_body</string> </key>
<value> <string># XXX bad name: AccountingTransaction_getMirrorSectionTitle sounds more consistent\n
\n
try:\n
return context.delivery_mirror_section_title\n
except AttributeError:\n
pass\n
\n
if brain is not None:\n
transaction = brain.getObject()\n
else:\n
transaction = context\n
\n
if transaction.AccountingTransaction_isSourceView():\n
return transaction.getDestinationSectionTitle()\n
return transaction.getSourceSectionTitle()\n
mirror_section_key = \'mirror_section_value_%s\' % transaction.getId()\n
\n
try:\n
mirror_section = context.REQUEST[mirror_section_key]\n
except KeyError:\n
if transaction.AccountingTransaction_isSourceView():\n
mirror_section = transaction.getDestinationSectionValue()\n
else:\n
mirror_section = transaction.getSourceSectionValue()\n
context.REQUEST.set(mirror_section_key, mirror_section)\n
\n
if mirror_section is not None:\n
return mirror_section.getTitle()\n
</string> </value>
</item>
<item>
......@@ -120,10 +136,15 @@ return transaction.getSourceSectionTitle()\n
<string>selection</string>
<string>selection_name</string>
<string>kw</string>
<string>None</string>
<string>_getattr_</string>
<string>transaction</string>
<string>context</string>
<string>AttributeError</string>
<string>None</string>
<string>transaction</string>
<string>mirror_section_key</string>
<string>_getitem_</string>
<string>mirror_section</string>
<string>KeyError</string>
</tuple>
</value>
</item>
......
......@@ -65,22 +65,32 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string># XXX bad name: AccountingTransaction_getMirrorSection sounds more consistent\n
section_category=context.portal_selections.getSelectionParamsFor(selection_name).get(\'section_category\')\n
if not section_category:\n
return\n
<value> <string># XXX bad name: AccountingTransaction_getMirrorSectionUrl sounds more consistent\n
url_template = \'%s/Entity_viewAccountingTransactionList?reset:int=1\'\n
\n
transaction = brain.getObject()\n
source_section = transaction.getSourceSectionValue()\n
try:\n
return url_template % context.getPortalObject().restrictedTraverse(context.delivery_mirror_section_path).absolute_url()\n
except AttributeError:\n
pass\n
\n
if source_section is not None and source_section.isMemberOf(section_category):\n
mirror_section = transaction.getDestinationSectionValue()\n
if brain is not None:\n
transaction = brain.getObject()\n
else:\n
mirror_section = transaction.getSourceSectionValue()\n
transaction = context\n
\n
mirror_section_key = \'mirror_section_value_%s\' % transaction.getId()\n
\n
try:\n
mirror_section = context.REQUEST[mirror_section_key]\n
except KeyError:\n
if transaction.AccountingTransaction_isSourceView():\n
mirror_section = transaction.getDestinationSectionValue()\n
else:\n
mirror_section = transaction.getSourceSectionValue()\n
context.REQUEST.set(mirror_section_key, mirror_section)\n
\n
if mirror_section is not None:\n
return "%s/Entity_viewAccountingTransactionList?reset:int=1" %\\\n
mirror_section.absolute_url()\n
return url_template % mirror_section.absolute_url()\n
</string> </value>
</item>
<item>
......@@ -127,13 +137,16 @@ if mirror_section is not None:\n
<string>selection</string>
<string>selection_name</string>
<string>kwd</string>
<string>url_template</string>
<string>_getattr_</string>
<string>context</string>
<string>section_category</string>
<string>transaction</string>
<string>source_section</string>
<string>AttributeError</string>
<string>None</string>
<string>transaction</string>
<string>mirror_section_key</string>
<string>_getitem_</string>
<string>mirror_section</string>
<string>KeyError</string>
</tuple>
</value>
</item>
......
617
\ No newline at end of file
619
\ 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