diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/QuantityUnitConversionModule_getUniversalDefinitionDict.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/QuantityUnitConversionModule_getUniversalDefinitionDict.xml new file mode 100644 index 0000000000000000000000000000000000000000..d043824529f4dca54c423b8e5cf4e0d6a4c05d7d --- /dev/null +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/QuantityUnitConversionModule_getUniversalDefinitionDict.xml @@ -0,0 +1,169 @@ +<?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>Script_magic</string> </key> + <value> <int>3</int> </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>def getUniversalQuantityUnitDefinitionDict():\n +\n + kw = dict(portal_type="Quantity Unit Conversion Definition",\n + grand_parent_portal_type="Quantity Unit Conversion Module")\n +\n + result = {}\n + for definition in context.portal_catalog(**kw):\n + definition = definition.getObject()\n + definition_list = definition.getParentValue()\n + standard_quantity_unit_uid = definition_list.getQuantityUnitUid()\n + if standard_quantity_unit_uid is None:\n + continue\n +\n + result[standard_quantity_unit_uid] = (None, 1.0)\n + unit_uid = definition.getQuantityUnitUid()\n + if unit_uid is None:\n + continue\n + quantity = definition.getQuantity()\n + if not quantity:\n + continue\n + result[unit_uid] = (definition.getUid(), quantity)\n +\n + return result\n +\n +def getCategoryQuantityUnitDefinitionDict():\n + quantity_unit = context.portal_categories.quantity_unit\n + result = {}\n + for obj in quantity_unit.getCategoryMemberValueList(portal_type="Category"):\n + obj = obj.getObject()\n + quantity = obj.getProperty(\'quantity\')\n + if quantity is not None:\n + result[obj.getUid()] = (None, float(quantity))\n +\n + return result\n +\n +def getQuantityUnitDefinitionDict():\n + result = getUniversalQuantityUnitDefinitionDict()\n + if not result:\n + result = getCategoryQuantityUnitDefinitionDict()\n + return result\n +\n +from Products.ERP5Type.Cache import CachingMethod\n +return CachingMethod(getQuantityUnitDefinitionDict,\n + "getUniversalQuantityUnitDefinitionDict",\n + cache_factory="erp5_content_long")()\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></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>getUniversalQuantityUnitDefinitionDict</string> + <string>getCategoryQuantityUnitDefinitionDict</string> + <string>getQuantityUnitDefinitionDict</string> + <string>Products.ERP5Type.Cache</string> + <string>CachingMethod</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>QuantityUnitConversionModule_getUniversalDefinitionDict</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/QuantityUnitConversionModule_invalidateUniversalDefinitionDict.xml b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/QuantityUnitConversionModule_invalidateUniversalDefinitionDict.xml new file mode 100644 index 0000000000000000000000000000000000000000..d2565035632c83fa88e148a7f5f865b6fb11c681 --- /dev/null +++ b/bt5/erp5_pdm/SkinTemplateItem/portal_skins/erp5_pdm/QuantityUnitConversionModule_invalidateUniversalDefinitionDict.xml @@ -0,0 +1,134 @@ +<?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>Script_magic</string> </key> + <value> <int>3</int> </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>from Products.ERP5Type.Cache import CachingMethod\n +def foo(): pass\n +cached = CachingMethod(foo,\n + "getUniversalQuantityUnitDefinitionDict",\n + cache_factory="erp5_content_long")\n +\n +cached.delete()\n +\n +context.QuantityUnitConversionModule_getUniversalDefinitionDict()\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></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>Products.ERP5Type.Cache</string> + <string>CachingMethod</string> + <string>foo</string> + <string>cached</string> + <string>_getattr_</string> + <string>context</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>QuantityUnitConversionModule_invalidateUniversalDefinitionDict</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/quantity_unit_conversion_interaction_workflow/scripts/QuantityUnitConversionDefinition_reindexResource.xml b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/quantity_unit_conversion_interaction_workflow/scripts/QuantityUnitConversionDefinition_reindexResource.xml index b8441808cd5a572bec710d08e275c5c40ef60783..a7cd122f49bcbf8dd7616936748369a27716d27a 100644 --- a/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/quantity_unit_conversion_interaction_workflow/scripts/QuantityUnitConversionDefinition_reindexResource.xml +++ b/bt5/erp5_pdm/WorkflowTemplateItem/portal_workflow/quantity_unit_conversion_interaction_workflow/scripts/QuantityUnitConversionDefinition_reindexResource.xml @@ -66,6 +66,8 @@ else:\n # This was a global definition.\n # Its change implies that all local definitions need reindexation\n # Even resources that do NOT override definitions need indexation.\n + context.activate(tag="QuantityUnitConversionDefinition_reindexResource", **activate_kw).QuantityUnitConversionModule_invalidateUniversalDefinitionDict()\n + activate_kw["after_tag"] = "QuantityUnitConversionDefinition_reindexResource"\n context.product_module.recursiveReindexObject(activate_kw=activate_kw)\n </string> </value> </item> @@ -110,7 +112,9 @@ else:\n <string>grand_parent</string> <string>dict</string> <string>activate_kw</string> + <string>_apply_</string> <string>context</string> + <string>_write_</string> </tuple> </value> </item> diff --git a/bt5/erp5_pdm/bt/revision b/bt5/erp5_pdm/bt/revision index 27384974685c11f34eb44981eec6c97f035971e8..ce163e7b6b4b7eef56c4445149326a929a7a7e3e 100644 --- a/bt5/erp5_pdm/bt/revision +++ b/bt5/erp5_pdm/bt/revision @@ -1 +1 @@ -439 \ No newline at end of file +440 \ No newline at end of file