Commit c12c649c authored by Jérome Perrin's avatar Jérome Perrin

Show correctly supplier reference or client reference

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31362 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 01006119
...@@ -54,9 +54,37 @@ ...@@ -54,9 +54,37 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>def getSourceReference(line):\n <value> <string>def getSourceReference(line):\n
return \'\' # FIXME: what is it ???\n category_list = line.getAcquiredCategoryList()\n
portal_type_list = (\'Purchase Supply Line\',\n
\'Purchase Supply Cell\',)\n
tmp_context = line.asContext(context=line, categories=category_list)\n
predicate_list = context.portal_domains.searchPredicateList(tmp_context, portal_type=portal_type_list)\n
for predicate in predicate_list:\n
source_reference = predicate.getSourceReference()\n
if source_reference:\n
return source_reference\n
return \'\'\n
\n \n
excluded_portal_type_list = context.getPortalTaxMovementTypeList() + context.getPortalAccountingMovementTypeList()\n def getDestinationReference(line):\n
category_list = line.getAcquiredCategoryList()\n
portal_type_list = (\'Sale Supply Line\',\n
\'Sale Supply Cell\',)\n
tmp_context = line.asContext(context=line, categories=category_list)\n
predicate_list = context.portal_domains.searchPredicateList(tmp_context, portal_type=portal_type_list)\n
for predicate in predicate_list:\n
destination_reference = predicate.getDestinationReference()\n
if destination_reference:\n
return destination_reference\n
return \'\'\n
\n
#if context.getPortalType() in context.getPortalSaleTypeList():\n
if \'Sale\' in context.getPortalType():\n
reference_method = getDestinationReference\n
else:\n
reference_method = getSourceReference\n
\n
excluded_portal_type_list = context.getPortalTaxMovementTypeList() \\\n
+ context.getPortalAccountingMovementTypeList()\n
\n \n
def getSubLineList(obj):\n def getSubLineList(obj):\n
sub_list = []\n sub_list = []\n
...@@ -69,7 +97,7 @@ def getSubLineList(obj):\n ...@@ -69,7 +97,7 @@ def getSubLineList(obj):\n
sub_list.extend(getSubLineList(x))\n sub_list.extend(getSubLineList(x))\n
return sub_list\n return sub_list\n
\n \n
data_dict = context.Delivery_getODTDataDict(getSourceReference, getSubLineList)\n data_dict = context.Delivery_getODTDataDict(reference_method, getSubLineList)\n
\n \n
bank_account = context.getDestinationPaymentValue(portal_type=\'Bank Account\')\n bank_account = context.getDestinationPaymentValue(portal_type=\'Bank Account\')\n
if context.getPortalType() == \'Sale Invoice Transaction\':\n if context.getPortalType() == \'Sale Invoice Transaction\':\n
...@@ -122,8 +150,10 @@ return data_dict\n ...@@ -122,8 +150,10 @@ return data_dict\n
<value> <value>
<tuple> <tuple>
<string>getSourceReference</string> <string>getSourceReference</string>
<string>getDestinationReference</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>reference_method</string>
<string>excluded_portal_type_list</string> <string>excluded_portal_type_list</string>
<string>getSubLineList</string> <string>getSubLineList</string>
<string>data_dict</string> <string>data_dict</string>
......
320 321
\ No newline at end of file \ No newline at end of file
...@@ -56,9 +56,7 @@ ...@@ -56,9 +56,7 @@
<value> <string>def getSourceReference(line):\n <value> <string>def getSourceReference(line):\n
category_list = line.getAcquiredCategoryList()\n category_list = line.getAcquiredCategoryList()\n
portal_type_list = (\'Purchase Supply Line\',\n portal_type_list = (\'Purchase Supply Line\',\n
\'Purchase Supply Cell\',\n \'Purchase Supply Cell\',)\n
\'Sale Supply Line\',\n
\'Sale Supply Cell\',)\n
tmp_context = line.asContext(context=line, categories=category_list)\n tmp_context = line.asContext(context=line, categories=category_list)\n
predicate_list = context.portal_domains.searchPredicateList(tmp_context, portal_type=portal_type_list)\n predicate_list = context.portal_domains.searchPredicateList(tmp_context, portal_type=portal_type_list)\n
for predicate in predicate_list:\n for predicate in predicate_list:\n
...@@ -67,6 +65,24 @@ ...@@ -67,6 +65,24 @@
return source_reference\n return source_reference\n
return \'\'\n return \'\'\n
\n \n
def getDestinationReference(line):\n
category_list = line.getAcquiredCategoryList()\n
portal_type_list = (\'Sale Supply Line\',\n
\'Sale Supply Cell\',)\n
tmp_context = line.asContext(context=line, categories=category_list)\n
predicate_list = context.portal_domains.searchPredicateList(tmp_context, portal_type=portal_type_list)\n
for predicate in predicate_list:\n
destination_reference = predicate.getDestinationReference()\n
if destination_reference:\n
return destination_reference\n
return \'\'\n
\n
#if context.getPortalType() in context.getPortalSaleTypeList():\n
if \'Sale\' in context.getPortalType():\n
reference_method = getDestinationReference\n
else:\n
reference_method = getSourceReference\n
\n
def getSubLineList(obj):\n def getSubLineList(obj):\n
sub_list = []\n sub_list = []\n
for x in obj.contentValues(portal_type=context.getPortalOrderMovementTypeList(),\n for x in obj.contentValues(portal_type=context.getPortalOrderMovementTypeList(),\n
...@@ -78,7 +94,7 @@ def getSubLineList(obj):\n ...@@ -78,7 +94,7 @@ def getSubLineList(obj):\n
sub_list.extend(getSubLineList(x))\n sub_list.extend(getSubLineList(x))\n
return sub_list\n return sub_list\n
\n \n
return context.Delivery_getODTDataDict(getSourceReference, getSubLineList)\n return context.Delivery_getODTDataDict(reference_method, getSubLineList)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -116,9 +132,11 @@ return context.Delivery_getODTDataDict(getSourceReference, getSubLineList)\n ...@@ -116,9 +132,11 @@ return context.Delivery_getODTDataDict(getSourceReference, getSubLineList)\n
<value> <value>
<tuple> <tuple>
<string>getSourceReference</string> <string>getSourceReference</string>
<string>getSubLineList</string> <string>getDestinationReference</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>reference_method</string>
<string>getSubLineList</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
812 813
\ 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