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> ...@@ -672,7 +672,10 @@ destination_section_where_expression</string> </value>
</dtml-if>\n </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\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 select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n </dtml-if>\n
\n \n
...@@ -861,7 +864,10 @@ UNION\n ...@@ -861,7 +864,10 @@ UNION\n
</dtml-if>\n </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\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 select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n </dtml-if>\n
\n \n
...@@ -1327,7 +1333,10 @@ UNION\n ...@@ -1327,7 +1333,10 @@ UNION\n
</dtml-if>\n </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\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 select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n </dtml-if>\n
\n \n
...@@ -1516,7 +1525,10 @@ UNION\n ...@@ -1516,7 +1525,10 @@ UNION\n
</dtml-if>\n </dtml-if>\n
</dtml-let>\n </dtml-let>\n
</dtml-if>\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 select_expression><dtml-var select_expression> </dtml-if>\n
</dtml-if>\n </dtml-if>\n
\n \n
......
...@@ -66,14 +66,30 @@ ...@@ -66,14 +66,30 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># XXX bad name: AccountingTransaction_getMirrorSectionTitle sounds more consistent\n <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 if brain is not None:\n
transaction = brain.getObject()\n transaction = brain.getObject()\n
else:\n else:\n
transaction = context\n transaction = context\n
\n \n
if transaction.AccountingTransaction_isSourceView():\n mirror_section_key = \'mirror_section_value_%s\' % transaction.getId()\n
return transaction.getDestinationSectionTitle()\n \n
return transaction.getSourceSectionTitle()\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> </string> </value>
</item> </item>
<item> <item>
...@@ -120,10 +136,15 @@ return transaction.getSourceSectionTitle()\n ...@@ -120,10 +136,15 @@ return transaction.getSourceSectionTitle()\n
<string>selection</string> <string>selection</string>
<string>selection_name</string> <string>selection_name</string>
<string>kw</string> <string>kw</string>
<string>None</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>transaction</string>
<string>context</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> </tuple>
</value> </value>
</item> </item>
......
...@@ -65,22 +65,32 @@ ...@@ -65,22 +65,32 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># XXX bad name: AccountingTransaction_getMirrorSection sounds more consistent\n <value> <string># XXX bad name: AccountingTransaction_getMirrorSectionUrl sounds more consistent\n
section_category=context.portal_selections.getSelectionParamsFor(selection_name).get(\'section_category\')\n url_template = \'%s/Entity_viewAccountingTransactionList?reset:int=1\'\n
if not section_category:\n
return\n
\n \n
transaction = brain.getObject()\n try:\n
source_section = transaction.getSourceSectionValue()\n return url_template % context.getPortalObject().restrictedTraverse(context.delivery_mirror_section_path).absolute_url()\n
except AttributeError:\n
pass\n
\n \n
if source_section is not None and source_section.isMemberOf(section_category):\n if brain is not None:\n
mirror_section = transaction.getDestinationSectionValue()\n transaction = brain.getObject()\n
else:\n else:\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 mirror_section = transaction.getSourceSectionValue()\n
context.REQUEST.set(mirror_section_key, mirror_section)\n
\n \n
if mirror_section is not None:\n if mirror_section is not None:\n
return "%s/Entity_viewAccountingTransactionList?reset:int=1" %\\\n return url_template % mirror_section.absolute_url()\n
mirror_section.absolute_url()\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -127,13 +137,16 @@ if mirror_section is not None:\n ...@@ -127,13 +137,16 @@ if mirror_section is not None:\n
<string>selection</string> <string>selection</string>
<string>selection_name</string> <string>selection_name</string>
<string>kwd</string> <string>kwd</string>
<string>url_template</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>section_category</string> <string>AttributeError</string>
<string>transaction</string>
<string>source_section</string>
<string>None</string> <string>None</string>
<string>transaction</string>
<string>mirror_section_key</string>
<string>_getitem_</string>
<string>mirror_section</string> <string>mirror_section</string>
<string>KeyError</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
617 619
\ 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