Commit 1f2086db authored by Jérome Perrin's avatar Jérome Perrin

remove InvoiceTransactionLine_getDestinationItemList and...

remove InvoiceTransactionLine_getDestinationItemList and InvoiceTransactionLine_getSourceItemList in favor of AccountingTransactionLine_getNodeItemList, which fixes source/destination inversion on lines ids for Purchase Invoice Transactions.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9163 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a4e76f7a
...@@ -302,7 +302,7 @@ ...@@ -302,7 +302,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:here.InvoiceTransactionLine_getSourceItemList()</string> </value> <value> <string>python:here.AccountingTranscationLine_getNodeItemList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""Return item list of accounts that can be used as node for this accounting\n
transaction line.\n
The id of the line is used to filter the list. If `mirror` is set to a true\n
value, the list will be filtered for the mirror node.\n
"""\n
from Products.ERP5Type.Cache import CachingMethod\n
\n
if not mirror:\n
category_dict = {\n
\'income\': \'account_type/income\',\n
\'expense\': \'account_type/expense\',\n
\'payable\': \'account_type/liability/payable\',\n
\'receivable\': \'account_type/asset/receivable\',\n
\'collected_vat\': \'account_type/liability/payable/collected_vat\',\n
\'refundable_vat\': \'account_type/asset/receivable/refundable_vat\',\n
\'bank\': \'account_type/asset/cash\',\n
\'cash\': \'account_type/asset/cash\', }\n
else:\n
category_dict = {\n
\'income\': \'account_type/expense\',\n
\'expense\': \'account_type/income\',\n
\'payable\': \'account_type/asset/receivable\',\n
\'receivable\': \'account_type/liability/payable\',\n
\'collected_vat\': \'account_type/asset/receivable/refundable_vat\',\n
\'refundable_vat\': \'account_type/liability/payable/collected_vat\',\n
\'bank\': \'account_type/asset/cash\',\n
\'cash\': \'account_type/asset/cash\', }\n
\n
category = category_dict.get(context.getId(), \'account_type\')\n
\n
display_cache = {}\n
display_funct = context.Account_getFormattedTitle\n
\n
def display(x):\n
if x not in display_cache:\n
display_cache[x] = display_funct(x)\n
return display_cache[x]\n
\n
def sort(x,y):\n
return cmp(display(x), display(y))\n
\n
def getItemList(category=None, portal_path=None, mirror=0,\n
user_name=None, simulation_state=None):\n
"""Returns a list of Account path items. """\n
cat = context.portal_categories.resolveCategory(category)\n
filter_dict = {}\n
\n
# we don\'t filter in existing transactions or report / search dialogs\n
if simulation_state not in (\'delivered\', \'cancelled\', \'no_simulation_state\'):\n
filter_dict[\'validation_state\'] = (\'draft\', \'validated\')\n
\n
item_list = cat.getCategoryMemberItemList(\n
portal_type=\'Account\',\n
base=0,\n
display_method=display,\n
sort_method=sort,\n
strict_membership=1,\n
filter=filter_dict)\n
return item_list\n
\n
# wrap the previous method in a cache\n
getItemList = CachingMethod(getItemList,\n
id=\'AccountingTransactionLine_getNodeItemList\')\n
\n
# the cache vary with the simulation state of the current transaction,\n
# to display all accounts when the transaction is already delivered.\n
return getItemList( category=category,\n
portal_path=context.getPortalObject().getPhysicalPath(),\n
mirror=mirror,\n
user_name=context.REQUEST.AUTHENTICATED_USER,\n
simulation_state=context.getProperty(\n
\'simulation_state\', \'no_simulation_state\') )\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_dav_writelocks</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>mirror=0</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>mirror</string>
<string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string>
<string>category_dict</string>
<string>_getattr_</string>
<string>context</string>
<string>category</string>
<string>display_cache</string>
<string>display_funct</string>
<string>display</string>
<string>sort</string>
<string>None</string>
<string>getItemList</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountingTransactionLine_getNodeItemList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.InvoiceTransactionLine_getSourceItemList()</string> </value> <value> <string>here/AccountingTransactionLine_getNodeItemList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -68,20 +68,10 @@ ...@@ -68,20 +68,10 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>category_dict = {\n <value> <string>context.log(\'erp5_accounting\',\n
\'income\': \'account_type/expense\',\n \'InvoiceTransactionLine_getDestinationItemList is a deprecated compatibility\'\n
\'expense\': \'account_type/income\',\n \' alias to AccountingTransactionLine_getNodeItemList(mirror=1)\')\n
\'payable\': \'account_type/asset/receivable\',\n return context.AccountingTransactionLine_getNodeItemList(mirror=1)\n
\'receivable\': \'account_type/liability/payable\',\n
\'collected_vat\': \'account_type/asset/receivable/refundable_vat\',\n
\'refundable_vat\': \'account_type/liability/payable/collected_vat\',\n
\'bank\': \'account_type/asset/cash\',\n
\'cash\': \'account_type/asset/cash\',\n
}\n
\n
return context.InvoiceTransactionLine_getSourceItemList(\n
category_dict=category_dict,\n
caching_method_id=\'InvoiceTransactionLine_getDestinationItemList\' )\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -130,7 +120,6 @@ return context.InvoiceTransactionLine_getSourceItemList(\n ...@@ -130,7 +120,6 @@ return context.InvoiceTransactionLine_getSourceItemList(\n
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>category_dict</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
</tuple> </tuple>
......
...@@ -68,57 +68,10 @@ ...@@ -68,57 +68,10 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Cache import CachingMethod\n <value> <string>context.log(\'erp5_accounting\',\n
\n \'InvoiceTransactionLine_getSourceItemList is a deprecated compatibility\'\n
if category_dict is None:\n \' alias to AccountingTransactionLine_getNodeItemList()\')\n
# this code is shared by InvoiceTransactionLine_getSourceItemList, \n return context.AccountingTransactionLine_getNodeItemList()\n
# which provides it\'s own dict\n
category_dict = {\n
\'income\': \'account_type/income\',\n
\'expense\': \'account_type/expense\',\n
\'payable\': \'account_type/liability/payable\',\n
\'receivable\': \'account_type/asset/receivable\',\n
\'collected_vat\': \'account_type/liability/payable/collected_vat\',\n
\'refundable_vat\': \'account_type/asset/receivable/refundable_vat\',\n
\'bank\': \'account_type/asset/cash\',\n
}\n
category = category_dict.get(context.getId(), \'account_type\')\n
\n
\n
display_cache = {}\n
display_funct = context.Account_getFormattedTitle\n
\n
def display(x):\n
if x not in display_cache:\n
display_cache[x] = display_funct(x)\n
return display_cache[x]\n
\n
def sort(x,y):\n
return cmp(display(x), display(y))\n
\n
def getItemList(category=None, portal_path=None, user_name=None, simulation_state=None):\n
"""Returns a list of Account path items. """\n
cat = context.portal_categories.resolveCategory(category)\n
filter_dict = {}\n
\n
# we don\'t filter in existing transactions or report / search dialogs\n
if simulation_state not in (\'delivered\', \'cancelled\', \'no_simulation_state\') :\n
filter_dict[\'validation_state\'] = (\'draft\', \'validated\')\n
\n
item_list = cat.getCategoryMemberItemList(portal_type=\'Account\', base=0,\n
display_method=display, sort_method=sort, filter=filter_dict)\n
return item_list\n
\n
# wrap the previous method in a cache\n
getItemList = CachingMethod(getItemList, id=caching_method_id)\n
\n
# the cache vary with the simulation state of the current transaction,\n
# to display all accounts when the transaction is already delivered.\n
return getItemList( category=category,\n
portal_path=context.getPortalObject().getPhysicalPath(), \n
user_name=context.REQUEST.AUTHENTICATED_USER,\n
simulation_state=context.getProperty(\n
\'simulation_state\', \'no_simulation_state\') )\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -169,17 +122,8 @@ return getItemList( category=category,\n ...@@ -169,17 +122,8 @@ return getItemList( category=category,\n
<tuple> <tuple>
<string>category_dict</string> <string>category_dict</string>
<string>caching_method_id</string> <string>caching_method_id</string>
<string>Products.ERP5Type.Cache</string>
<string>CachingMethod</string>
<string>None</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>category</string>
<string>display_cache</string>
<string>display_funct</string>
<string>display</string>
<string>sort</string>
<string>getItemList</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -82,11 +82,11 @@ transaction.edit (\n ...@@ -82,11 +82,11 @@ transaction.edit (\n
resource = preference_tool.getPreferredAccountingTransactionCurrency())\n resource = preference_tool.getPreferredAccountingTransactionCurrency())\n
\n \n
transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n
id=\'income\', )\n id=\'expense\', )\n
transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n
id=\'receivable\', )\n id=\'payable\', )\n
transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n transaction.newContent(portal_type=\'Purchase Invoice Transaction Line\',\n
id=\'collected_vat\', )\n id=\'refundable_vat\', )\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getDestinationItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList(mirror=1)</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python:cell.getObject().InvoiceTransactionLine_getSourceItemList()</string> </value> <value> <string>python:cell.getObject().AccountingTransactionLine_getNodeItemList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
2006-08-11 jerome
* remove InvoiceTransactionLine_getDestinationItemList and InvoiceTransactionLine_getSourceItemList in favor of AccountingTransactionLine_getNodeItemList, which fixes source/destination inversion on lines ids for Purchase Invoice Transactions.
2006-07-03 Kevin 2006-07-03 Kevin
* Move Base_importGapFile script from gap_importer business template. * Move Base_importGapFile script from gap_importer business template.
......
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