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 @@
<item>
<key> <string>_body</string> </key>
<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
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
def getSubLineList(obj):\n
sub_list = []\n
......@@ -69,7 +97,7 @@ def getSubLineList(obj):\n
sub_list.extend(getSubLineList(x))\n
return sub_list\n
\n
data_dict = context.Delivery_getODTDataDict(getSourceReference, getSubLineList)\n
data_dict = context.Delivery_getODTDataDict(reference_method, getSubLineList)\n
\n
bank_account = context.getDestinationPaymentValue(portal_type=\'Bank Account\')\n
if context.getPortalType() == \'Sale Invoice Transaction\':\n
......@@ -122,8 +150,10 @@ return data_dict\n
<value>
<tuple>
<string>getSourceReference</string>
<string>getDestinationReference</string>
<string>_getattr_</string>
<string>context</string>
<string>reference_method</string>
<string>excluded_portal_type_list</string>
<string>getSubLineList</string>
<string>data_dict</string>
......
320
\ No newline at end of file
321
\ No newline at end of file
......@@ -56,9 +56,7 @@
<value> <string>def getSourceReference(line):\n
category_list = line.getAcquiredCategoryList()\n
portal_type_list = (\'Purchase Supply Line\',\n
\'Purchase Supply Cell\',\n
\'Sale Supply Line\',\n
\'Sale Supply Cell\',)\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
......@@ -67,6 +65,24 @@
return source_reference\n
return \'\'\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
sub_list = []\n
for x in obj.contentValues(portal_type=context.getPortalOrderMovementTypeList(),\n
......@@ -78,7 +94,7 @@ def getSubLineList(obj):\n
sub_list.extend(getSubLineList(x))\n
return sub_list\n
\n
return context.Delivery_getODTDataDict(getSourceReference, getSubLineList)\n
return context.Delivery_getODTDataDict(reference_method, getSubLineList)\n
</string> </value>
</item>
<item>
......@@ -116,9 +132,11 @@ return context.Delivery_getODTDataDict(getSourceReference, getSubLineList)\n
<value>
<tuple>
<string>getSourceReference</string>
<string>getSubLineList</string>
<string>getDestinationReference</string>
<string>_getattr_</string>
<string>context</string>
<string>reference_method</string>
<string>getSubLineList</string>
</tuple>
</value>
</item>
......
812
\ No newline at end of file
813
\ 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