Commit 34325e94 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

copy payment conditions from order to packing list, and from packing list to invoice transaction.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33017 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 885bb61e
...@@ -53,7 +53,9 @@ ...@@ -53,7 +53,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""This script is called on the Invoice after the delivery builder has created\n <value> <string encoding="cdata"><![CDATA[
"""This script is called on the Invoice after the delivery builder has created\n
the new Invoice.\n the new Invoice.\n
"""\n """\n
from Products.ERP5Type.Message import translateString\n from Products.ERP5Type.Message import translateString\n
...@@ -77,8 +79,22 @@ if not invoice.Invoice_isAdvanced():\n ...@@ -77,8 +79,22 @@ if not invoice.Invoice_isAdvanced():\n
invoice.setResource(invoice.getPriceCurrency())\n invoice.setResource(invoice.getPriceCurrency())\n
\n \n
related_packing_list = invoice.getDefaultCausalityValue()\n related_packing_list = invoice.getDefaultCausalityValue()\n
\n
related_order = related_packing_list.getDefaultCausalityValue()\n related_order = related_packing_list.getDefaultCausalityValue()\n
\n
# copy payment conditions from packing list\n
# if missing, try to copy from order (for compatibility)\n
payment_condition_copy_id_list = related_packing_list.contentIds(filter={\'portal_type\':\'Payment Condition\'})\n
if len(payment_condition_copy_id_list) > 0:\n
clipboard = related_packing_list.manage_copyObjects(\n
ids=payment_condition_copy_id_list)\n
invoice.manage_pasteObjects(clipboard)\n
elif related_order is not None:\n
payment_condition_copy_id_list = related_order.contentIds(filter={\'portal_type\':\'Payment Condition\'})\n
if len(payment_condition_copy_id_list) > 0:\n
clipboard = related_order.manage_copyObjects(\n
ids=payment_condition_copy_id_list)\n
invoice.manage_pasteObjects(clipboard)\n
\n
if related_order is not None:\n if related_order is not None:\n
# copy trade condition:\n # copy trade condition:\n
if not context.getSpecialise():\n if not context.getSpecialise():\n
...@@ -113,7 +129,9 @@ invoice.startBuilding()\n ...@@ -113,7 +129,9 @@ invoice.startBuilding()\n
# Then an activity should put the causality state in diverged or solved\n # Then an activity should put the causality state in diverged or solved\n
invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n
(\'immediateReindexObject\',\'recursiveImmediateReindexObject\'))).updateCausalityState()\n (\'immediateReindexObject\',\'recursiveImmediateReindexObject\'))).updateCausalityState()\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -164,6 +182,9 @@ invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list ...@@ -164,6 +182,9 @@ invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list
<string>_getattr_</string> <string>_getattr_</string>
<string>related_packing_list</string> <string>related_packing_list</string>
<string>related_order</string> <string>related_order</string>
<string>payment_condition_copy_id_list</string>
<string>len</string>
<string>clipboard</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
...@@ -171,7 +192,6 @@ invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list ...@@ -171,7 +192,6 @@ invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list
<string>invoice_trade_model_line_reference_list</string> <string>invoice_trade_model_line_reference_list</string>
<string>order_trade_model_line_copy_id_list</string> <string>order_trade_model_line_copy_id_list</string>
<string>order_trade_model_line</string> <string>order_trade_model_line</string>
<string>clipboard</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
339 340
\ No newline at end of file \ No newline at end of file
...@@ -53,7 +53,9 @@ ...@@ -53,7 +53,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>packing_list = context\n <value> <string encoding="cdata"><![CDATA[
packing_list = context\n
related_order = packing_list.getCausalityValue()\n related_order = packing_list.getCausalityValue()\n
\n \n
if packing_list.getSimulationState() == \'draft\':\n if packing_list.getSimulationState() == \'draft\':\n
...@@ -61,7 +63,16 @@ if packing_list.getSimulationState() == \'draft\':\n ...@@ -61,7 +63,16 @@ if packing_list.getSimulationState() == \'draft\':\n
comment = related_order.getComment(),\n comment = related_order.getComment(),\n
title = related_order.getTitle()\n title = related_order.getTitle()\n
)\n )\n
</string> </value> \n
# copy order\'s payment conditions\n
payment_condition_copy_id_list = related_order.contentIds(filter={\'portal_type\':\'Payment Condition\'})\n
if len(payment_condition_copy_id_list) > 0:\n
clipboard = related_order.manage_copyObjects(\n
ids=payment_condition_copy_id_list)\n
packing_list.manage_pasteObjects(clipboard)\n
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -101,6 +112,9 @@ if packing_list.getSimulationState() == \'draft\':\n ...@@ -101,6 +112,9 @@ if packing_list.getSimulationState() == \'draft\':\n
<string>packing_list</string> <string>packing_list</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>related_order</string> <string>related_order</string>
<string>payment_condition_copy_id_list</string>
<string>len</string>
<string>clipboard</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
845 846
\ 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