Commit 18e2b190 authored by Jérome Perrin's avatar Jérome Perrin

- Automatically apply the trade condition when associating it to the order using relation field.

- Fix a bug in Order_applyTradeCondition, it was not copying the payment condition when applying twice

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24616 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5c7cf8bb
...@@ -99,6 +99,8 @@ def copyPaymentCondition(order, trade_condition):\n ...@@ -99,6 +99,8 @@ def copyPaymentCondition(order, trade_condition):\n
copyPaymentCondition(order, other_trade_condition)\n copyPaymentCondition(order, other_trade_condition)\n
\n \n
filter_dict = {\'portal_type\': \'Payment Condition\'}\n filter_dict = {\'portal_type\': \'Payment Condition\'}\n
if force:\n
order.manage_delObjects(list(order.contentIds(filter=filter_dict)))\n
if len(order.contentIds(filter=filter_dict)) == 0:\n if len(order.contentIds(filter=filter_dict)) == 0:\n
copyPaymentCondition(order, trade_condition)\n copyPaymentCondition(order, trade_condition)\n
\n \n
...@@ -229,6 +231,7 @@ order.edit(**new_category_dict)\n ...@@ -229,6 +231,7 @@ order.edit(**new_category_dict)\n
<string>_write_</string> <string>_write_</string>
<string>copyPaymentCondition</string> <string>copyPaymentCondition</string>
<string>filter_dict</string> <string>filter_dict</string>
<string>list</string>
<string>len</string> <string>len</string>
<string>initialiseDiscountLineList</string> <string>initialiseDiscountLineList</string>
<string>initialiseTaxLineList</string> <string>initialiseTaxLineList</string>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </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>context.setSpecialiseUidList(relation_uid_list, portal_type=portal_type)\n
\n
if relation_uid_list:\n
context.Order_applyTradeCondition(context.getSpecialiseValue(), force=1)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>relation_uid_list, portal_type</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>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>relation_uid_list</string>
<string>portal_type</string>
<string>_getattr_</string>
<string>context</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Order_setSpecialiseAndApplyTradeCondition</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<list> <list>
<string>title</string> <string>title</string>
<string>portal_type</string> <string>portal_type</string>
<string>relation_setter_id</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -94,6 +95,10 @@ ...@@ -94,6 +95,10 @@
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>relation_setter_id</string> </key>
<value> <string>Order_setSpecialiseAndApplyTradeCondition</string> </value>
</item>
<item> <item>
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value> <value> <string>Click to edit the target</string> </value>
......
528 529
\ 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