From c4f3d6839ffb7ffb2e1571647619ec2210c4b727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Tue, 1 Sep 2009 09:57:44 +0000 Subject: [PATCH] - 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 --- .../InvoiceTransaction_postGeneration.xml | 25 ++++++++++++++++++- bt5/erp5_invoicing/bt/revision | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceTransaction_postGeneration.xml b/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceTransaction_postGeneration.xml index fb852e8427..a5b0d3b42a 100644 --- a/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceTransaction_postGeneration.xml +++ b/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceTransaction_postGeneration.xml @@ -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> diff --git a/bt5/erp5_invoicing/bt/revision b/bt5/erp5_invoicing/bt/revision index 6eac4a65cd..8975db9a05 100644 --- a/bt5/erp5_invoicing/bt/revision +++ b/bt5/erp5_invoicing/bt/revision @@ -1 +1 @@ -292 \ No newline at end of file +293 \ No newline at end of file -- 2.30.9