Commit c4f3d683 authored by Łukasz Nowak's avatar Łukasz Nowak

- copy trade model lines from order when building invoice


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28712 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bf22132d
......@@ -78,12 +78,27 @@ if not invoice.Invoice_isAdvanced():\n
\n
related_packing_list = invoice.getDefaultCausalityValue()\n
\n
related_order = related_packing_list.getDefaultCausalityValue()\n
# copy trade condition:\n
if not context.getSpecialise():\n
related_order = related_packing_list.getDefaultCausalityValue()\n
if related_order is not None:\n
context.edit(specialise=related_order.getSpecialise())\n
\n
# copy order\'s trade model lines\n
invoice_trade_model_line_reference_list = [document.getReference() \\\n
for document in context.contentValues(portal_type=\'Trade Model Line\')]\n
order_trade_model_line_copy_id_list = []\n
for order_trade_model_line in related_order.contentValues(\n
portal_type=\'Trade Model Line\'):\n
if order_trade_model_line.getReference() not in \\\n
invoice_trade_model_line_reference_list:\n
order_trade_model_line_copy_id_list.append(order_trade_model_line.getId())\n
\n
if order_trade_model_line_copy_id_list:\n
clipboard = related_order.manage_copyObjects(\n
ids=order_trade_model_line_copy_id_list)\n
context.manage_pasteObjects(clipboard)\n
\n
# copy title, if not updating a new delivery\n
if not invoice.hasTitle() and related_packing_list.hasTitle():\n
invoice.setTitle(related_packing_list.getTitle())\n
......@@ -161,6 +176,14 @@ invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list
<string>_getattr_</string>
<string>related_packing_list</string>
<string>related_order</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>document</string>
<string>invoice_trade_model_line_reference_list</string>
<string>order_trade_model_line_copy_id_list</string>
<string>order_trade_model_line</string>
<string>clipboard</string>
<string>e</string>
</tuple>
</value>
......
292
\ No newline at end of file
293
\ 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