diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/packing_list_workflow/scripts/PackingList_buildInvoice.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/packing_list_workflow/scripts/PackingList_buildInvoice.xml deleted file mode 100644 index 29622d0861bf4b175e11da3df76d04c208686adb..0000000000000000000000000000000000000000 --- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/packing_list_workflow/scripts/PackingList_buildInvoice.xml +++ /dev/null @@ -1,175 +0,0 @@ -<?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>Python_magic</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>__ac_local_roles__</string> </key> - <value> - <none/> - </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>packing_list = sci[\'object\']\n -delivery_tool = sci.getPortal().portal_deliveries\n -\n -found = 0\n -builder_id_list = [\'sale_invoice_builder\', \'purchase_invoice_builder\']\n -for builder_id in builder_id_list:\n - if hasattr(delivery_tool, builder_id):\n - found = 1\n - builder = getattr(delivery_tool, builder_id)\n - builder.activate(\n - after_method_id = [ \'expand\', \n - \'recursiveImmediateReindexObject\',\n - \'updateAppliedRule\',\n - \'immediateReindexObject\' ],\n - ).build()\n -\n -if not found:\n - packing_list.log("ERP5 Simulation",\n - "Unable to build Invoice from packing list at %s "\\\n - ": no builder" % packing_list.getPath())\n -</string> </value> - </item> - <item> - <key> <string>_code</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>_filepath</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>_owner</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>sci</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>1</int> </value> - </item> - <item> - <key> <string>co_varnames</string> </key> - <value> - <tuple> - <string>sci</string> - <string>_getitem_</string> - <string>packing_list</string> - <string>_getattr_</string> - <string>delivery_tool</string> - <string>found</string> - <string>builder_id_list</string> - <string>_getiter_</string> - <string>builder_id</string> - <string>hasattr</string> - <string>getattr</string> - <string>builder</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>PackingList_buildInvoice</string> </value> - </item> - <item> - <key> <string>warnings</string> </key> - <value> - <tuple/> - </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/packing_list_workflow/scripts/PurchasePackingList_buildInvoice.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/packing_list_workflow/scripts/PurchasePackingList_buildInvoice.xml index f6817eb2d51b479fe9cfeba0ae223c7b92ff3de9..456fafc94d9df9b90d5e823af1efe822d848dc0b 100644 --- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/packing_list_workflow/scripts/PurchasePackingList_buildInvoice.xml +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/packing_list_workflow/scripts/PurchasePackingList_buildInvoice.xml @@ -65,10 +65,36 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>packing_list =sci[\'object\']\n + <value> <string>from Products.ERP5Type.Log import log\n +packing_list = sci[\'object\']\n +delivery_tool = sci.getPortal().portal_deliveries\n \n if packing_list.getPortalType() == \'Purchase Packing List\':\n - return context.PackingList_buildInvoice(sci)\n + tag = \'build_invoice_%s\' % packing_list.getRelativeUrl()\n + invoice_line_builder = getattr(delivery_tool, \'purchase_invoice_builder\', None)\n + if invoice_line_builder is not None:\n + invoice_line_builder.activate(\n + tag=tag,\n + activate_kw=dict(tag=tag),\n + after_method_id = [ \'expand\', \n + \'recursiveImmediateReindexObject\',\n + \'updateAppliedRule\',\n + \'immediateReindexObject\' ],\n + ).build()\n + else:\n + log(\'no purchase_invoice_builder found\')\n +\n + invoice_tax_builder = getattr(delivery_tool, \'purchase_invoice_tax_builder\', None)\n + if invoice_tax_builder is not None:\n + invoice_tax_builder.activate(\n + tag=tag,\n + after_method_id = [ \'expand\', \n + \'recursiveImmediateReindexObject\',\n + \'updateAppliedRule\',\n + \'immediateReindexObject\' ],\n + ).build()\n + else:\n + log(\'no purchase_invoice_tax_builder found\')\n </string> </value> </item> <item> @@ -112,10 +138,18 @@ if packing_list.getPortalType() == \'Purchase Packing List\':\n <value> <tuple> <string>sci</string> + <string>Products.ERP5Type.Log</string> + <string>log</string> <string>_getitem_</string> <string>packing_list</string> <string>_getattr_</string> - <string>context</string> + <string>delivery_tool</string> + <string>tag</string> + <string>getattr</string> + <string>None</string> + <string>invoice_line_builder</string> + <string>dict</string> + <string>invoice_tax_builder</string> </tuple> </value> </item> diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/packing_list_workflow/scripts/SalePackingList_buildInvoice.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/packing_list_workflow/scripts/SalePackingList_buildInvoice.xml index 914fd453d3512006cfcf31feacc573d699931226..47577ad436359e20dbfc4e4ee01ef8ac329c0845 100644 --- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/packing_list_workflow/scripts/SalePackingList_buildInvoice.xml +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/packing_list_workflow/scripts/SalePackingList_buildInvoice.xml @@ -65,10 +65,36 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>packing_list =sci[\'object\']\n + <value> <string>from Products.ERP5Type.Log import log\n +packing_list = sci[\'object\']\n +delivery_tool = sci.getPortal().portal_deliveries\n \n if packing_list.getPortalType() == \'Sale Packing List\':\n - return context.PackingList_buildInvoice(sci)\n + tag = \'build_invoice_%s\' % packing_list.getRelativeUrl()\n + invoice_line_builder = getattr(delivery_tool, \'sale_invoice_builder\', None)\n + if invoice_line_builder is not None:\n + invoice_line_builder.activate(\n + tag=tag,\n + activate_kw=dict(tag=tag),\n + after_method_id = [ \'expand\', \n + \'recursiveImmediateReindexObject\',\n + \'updateAppliedRule\',\n + \'immediateReindexObject\' ],\n + ).build()\n + else:\n + log(\'no sale_invoice_builder found\')\n +\n + invoice_tax_builder = getattr(delivery_tool, \'sale_invoice_tax_builder\', None)\n + if invoice_tax_builder is not None:\n + invoice_tax_builder.activate(\n + tag=tag,\n + after_method_id = [ \'expand\', \n + \'recursiveImmediateReindexObject\',\n + \'updateAppliedRule\',\n + \'immediateReindexObject\' ],\n + ).build()\n + else:\n + log(\'no sale_invoice_tax_builder found\')\n </string> </value> </item> <item> @@ -112,10 +138,18 @@ if packing_list.getPortalType() == \'Sale Packing List\':\n <value> <tuple> <string>sci</string> + <string>Products.ERP5Type.Log</string> + <string>log</string> <string>_getitem_</string> <string>packing_list</string> <string>_getattr_</string> - <string>context</string> + <string>delivery_tool</string> + <string>tag</string> + <string>getattr</string> + <string>None</string> + <string>invoice_line_builder</string> + <string>dict</string> + <string>invoice_tax_builder</string> </tuple> </value> </item> diff --git a/bt5/erp5_trade/bt/revision b/bt5/erp5_trade/bt/revision index b8e817d4f8350da183e38145325940a42494db8a..ae4d10b425edf2234036e6dd7b07f9bd53fc25e3 100644 --- a/bt5/erp5_trade/bt/revision +++ b/bt5/erp5_trade/bt/revision @@ -1 +1 @@ -255 \ No newline at end of file +256 \ No newline at end of file