Commit 5785bea9 authored by Yusei Tahara's avatar Yusei Tahara

2010-10-21 yusei

* Add reverse_arrow_category parameter to Order_applyTradeCondition. This option is useful when trade condition is applied to returned packing list.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39417 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 333390f1
......@@ -2,10 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
......@@ -83,19 +80,56 @@ def getPropertyFromTradeCondition(trade_condition, property_name):\n
if v:\n
return v\n
\n
\n
for category in category_list:\n
if force or not order.getPropertyList(category):\n
v = getPropertyFromTradeCondition(trade_condition, category)\n
if v:\n
new_category_dict[category] = v\n
# for accounting transactions, we also initialize resource with the price\n
# currency\n
if category == \'price_currency\' and \\\n
context.getPortalType() in \\\n
context.getPortalAccountingTransactionTypeList():\n
new_category_dict[\'resource\'] = v\n
\n
if not reverse_arrow_category:\n
for category in category_list:\n
if force or not order.getPropertyList(category):\n
v = getPropertyFromTradeCondition(trade_condition, category)\n
if v:\n
new_category_dict[category] = v\n
# for accounting transactions, we also initialize resource with the price\n
# currency\n
if category == \'price_currency\' and \\\n
context.getPortalType() in \\\n
context.getPortalAccountingTransactionTypeList():\n
new_category_dict[\'resource\'] = v\n
else:\n
# Reverse source and destination\n
# This is useful for Returned Sale/Purchase XXX types.\n
reverse_dict = {\n
\'source\':\'destination\',\n
\'source_section\':\'destination_section\',\n
\'source_decision\':\'destination_decision\',\n
\'source_administration\':\'destination_administration\',\n
\'source_payment\':\'destination_payment\',\n
\'source_project\':\'destination_project\',\n
\'source_carrier\':\'destination_carrier\',\n
\'source_referral\':\'destination_referral\',\n
\'source_function\':\'destination_function\',\n
\'destination\':\'source\',\n
\'destination_section\':\'source_section\',\n
\'destination_decision\':\'source_decision\',\n
\'destination_administration\':\'source_administration\',\n
\'destination_payment\':\'source_payment\',\n
\'destination_project\':\'source_project\',\n
\'destination_carrier\':\'source_carrier\',\n
\'destination_referral\':\'source_referral\',\n
\'destination_function\':\'source_function\',\n
}\n
for category in category_list:\n
if force or not order.getPropertyList(category):\n
if category in reverse_dict:\n
trade_condition_category = reverse_dict[category]\n
else:\n
trade_condition_category = category\n
v = getPropertyFromTradeCondition(trade_condition, trade_condition_category)\n
if v:\n
new_category_dict[category] = v\n
# for accounting transactions, we also initialize resource with the price\n
# currency\n
if category == \'price_currency\' and \\\n
context.getPortalType() in \\\n
context.getPortalAccountingTransactionTypeList():\n
new_category_dict[\'resource\'] = v\n
\n
def copyPaymentCondition(order, trade_condition):\n
filter_dict = {\'portal_type\': \'Payment Condition\'}\n
......@@ -128,7 +162,7 @@ order.edit(**new_category_dict)\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>trade_condition, force=0</string> </value>
<value> <string>trade_condition, force=0, reverse_arrow_category=0</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -148,7 +182,7 @@ order.edit(**new_category_dict)\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>2</int> </value>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -156,6 +190,7 @@ order.edit(**new_category_dict)\n
<tuple>
<string>trade_condition</string>
<string>force</string>
<string>reverse_arrow_category</string>
<string>context</string>
<string>order</string>
<string>category_list</string>
......@@ -166,6 +201,9 @@ order.edit(**new_category_dict)\n
<string>_getattr_</string>
<string>v</string>
<string>_write_</string>
<string>reverse_dict</string>
<string>_getitem_</string>
<string>trade_condition_category</string>
<string>copyPaymentCondition</string>
<string>filter_dict</string>
<string>list</string>
......@@ -184,6 +222,7 @@ order.edit(**new_category_dict)\n
<value>
<tuple>
<int>0</int>
<int>0</int>
</tuple>
</value>
</item>
......
2010-10-21 yusei
* Add reverse_arrow_category parameter to Order_applyTradeCondition. This option is useful when trade condition is applied to returned packing list.
2010-10-15 nicolas.dumazet
* No restrictions on subtypes of Order portal type
......
991
\ No newline at end of file
992
\ 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