From 3a848065ea71b126f0ba1aaac6d02df364aac6d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Thu, 13 Mar 2008 18:23:05 +0000 Subject: [PATCH] Use a script to display the resource title on the invoice line without acquiring the resource from the parent, because the parent resource is a currency git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19879 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../InvoiceLine_getResourceTitle.xml | 151 ++++++++++++++++++ .../my_resource_title.xml | 48 +++++- .../Invoice_viewFieldLibrary/listbox.xml | 4 +- bt5/erp5_invoicing/bt/revision | 2 +- 4 files changed, 196 insertions(+), 9 deletions(-) create mode 100644 bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceLine_getResourceTitle.xml diff --git a/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceLine_getResourceTitle.xml b/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceLine_getResourceTitle.xml new file mode 100644 index 0000000000..1f10869132 --- /dev/null +++ b/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceLine_getResourceTitle.xml @@ -0,0 +1,151 @@ +<?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>resource_list = context.getValueList(\'resource\')\n +if resource_list:\n + return resource_list[0].getTitle()\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>**kw</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>0</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>kw</string> + <string>_getattr_</string> +<string>context</string> + <string>resource_list</string> + <string>_getitem_</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>InvoiceLine_getResourceTitle</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceLine_viewFieldLibrary/my_resource_title.xml b/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceLine_viewFieldLibrary/my_resource_title.xml index 1109c54430..5791d6224b 100644 --- a/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceLine_viewFieldLibrary/my_resource_title.xml +++ b/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/InvoiceLine_viewFieldLibrary/my_resource_title.xml @@ -14,6 +14,8 @@ <value> <list> <string>title</string> + <string>description</string> + <string>default</string> <string>base_category</string> <string>portal_type</string> <string>catalog_index</string> @@ -60,13 +62,23 @@ <value> <dictionary> <item> - <key> <string>base_category</string> </key> + <key> <string>base_category</string> </key> <value> <string></string> </value> </item> <item> - <key> <string>catalog_index</string> </key> + <key> <string>catalog_index</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> <item> <key> <string>field_id</string> </key> <value> <string></string> </value> @@ -76,9 +88,9 @@ <value> <string></string> </value> </item> <item> - <key> <string>portal_type</string> </key> + <key> <string>portal_type</string> </key> <value> - <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> </value> </item> <item> @@ -86,7 +98,7 @@ <value> <string></string> </value> </item> <item> - <key> <string>title</string> </key> + <key> <string>title</string> </key> <value> <string></string> </value> </item> </dictionary> @@ -131,10 +143,18 @@ </list> </value> </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>default_module</string> </key> <value> <string>resource_module</string> </value> </item> + <item> + <key> <string>description</string> </key> + <value> <string>The product or service which is traded</string> </value> + </item> <item> <key> <string>field_id</string> </key> <value> <string>my_relation_field</string> </value> @@ -160,7 +180,7 @@ </item> <item> <key> <string>title</string> </key> - <value> <string>Resource</string> </value> + <value> <string>Product or Service</string> </value> </item> </dictionary> </value> @@ -169,6 +189,22 @@ </pickle> </record> <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>context/InvoiceLine_getResourceTitle</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> <pickle> <tuple> <global name="TALESMethod" module="Products.Formulator.TALESField"/> diff --git a/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/Invoice_viewFieldLibrary/listbox.xml b/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/Invoice_viewFieldLibrary/listbox.xml index 5049faf012..8f5081363e 100644 --- a/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/Invoice_viewFieldLibrary/listbox.xml +++ b/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/Invoice_viewFieldLibrary/listbox.xml @@ -98,8 +98,8 @@ <string>ID</string> </tuple> <tuple> - <string>resource_title</string> - <string>Resource</string> + <string>InvoiceLine_getResourceTitle</string> + <string>Product or Service</string> </tuple> <tuple> <string>total_quantity</string> diff --git a/bt5/erp5_invoicing/bt/revision b/bt5/erp5_invoicing/bt/revision index a5c750feac..368f89ceef 100644 --- a/bt5/erp5_invoicing/bt/revision +++ b/bt5/erp5_invoicing/bt/revision @@ -1 +1 @@ -27 \ No newline at end of file +28 \ No newline at end of file -- 2.30.9