diff --git a/bt5/erp5_base/ActionTemplateItem/portal_types/Split%20Category%20Movement%20Group/view.xml b/bt5/erp5_base/ActionTemplateItem/portal_types/Split%20Category%20Movement%20Group/view.xml new file mode 100644 index 0000000000000000000000000000000000000000..197525691e0eb86d68df5f1ab50ebe81d76bd1cf --- /dev/null +++ b/bt5/erp5_base/ActionTemplateItem/portal_types/Split%20Category%20Movement%20Group/view.xml @@ -0,0 +1,85 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="ActionInformation" module="Products.CMFCore.ActionInformation"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>action_type/object_view</string> + </tuple> + </value> + </item> + <item> + <key> <string>category</string> </key> + <value> <string>object_view</string> </value> + </item> + <item> + <key> <string>condition</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>icon</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>view</string> </value> + </item> + <item> + <key> <string>permissions</string> </key> + <value> + <tuple> + <string>View</string> + </tuple> + </value> + </item> + <item> + <key> <string>priority</string> </key> + <value> <float>1.0</float> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>View</string> </value> + </item> + <item> + <key> <string>visible</string> </key> + <value> <int>1</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <global name="Expression" module="Products.CMFCore.Expression"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>text</string> </key> + <value> <string>string:${object_url}/PropertyMovementGroup_view</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_base/ActionTemplateItem/portal_types/Split%20Property%20Movement%20Group/view.xml b/bt5/erp5_base/ActionTemplateItem/portal_types/Split%20Property%20Movement%20Group/view.xml new file mode 100644 index 0000000000000000000000000000000000000000..197525691e0eb86d68df5f1ab50ebe81d76bd1cf --- /dev/null +++ b/bt5/erp5_base/ActionTemplateItem/portal_types/Split%20Property%20Movement%20Group/view.xml @@ -0,0 +1,85 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="ActionInformation" module="Products.CMFCore.ActionInformation"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>action_type/object_view</string> + </tuple> + </value> + </item> + <item> + <key> <string>category</string> </key> + <value> <string>object_view</string> </value> + </item> + <item> + <key> <string>condition</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>icon</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>view</string> </value> + </item> + <item> + <key> <string>permissions</string> </key> + <value> + <tuple> + <string>View</string> + </tuple> + </value> + </item> + <item> + <key> <string>priority</string> </key> + <value> <float>1.0</float> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>View</string> </value> + </item> + <item> + <key> <string>visible</string> </key> + <value> <int>1</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <global name="Expression" module="Products.CMFCore.Expression"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>text</string> </key> + <value> <string>string:${object_url}/PropertyMovementGroup_view</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_base/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml b/bt5/erp5_base/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml index a3cc8a65d4fc4847d77f1159cfb860946304ff14..5127ff1f0c79aed384754a6e40cdd1c839a8c09e 100644 --- a/bt5/erp5_base/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml +++ b/bt5/erp5_base/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml @@ -31,7 +31,9 @@ <item>Quantity Sign Movement Group</item> <item>Requirement Movement Group</item> <item>Root Applied Rule Causality Movement Group</item> + <item>Split Category Movement Group</item> <item>Split Movement Group</item> + <item>Split Property Movement Group</item> <item>Tax Line Delivery Movement Group</item> <item>Title Movement Group</item> <item>Variant Movement Group</item> @@ -59,7 +61,9 @@ <item>Quantity Sign Movement Group</item> <item>Requirement Movement Group</item> <item>Root Applied Rule Causality Movement Group</item> + <item>Split Category Movement Group</item> <item>Split Movement Group</item> + <item>Split Property Movement Group</item> <item>Title Movement Group</item> <item>Variant Movement Group</item> <item>Variation Property Movement Group</item> diff --git a/bt5/erp5_base/PortalTypeTemplateItem/portal_types/Split%20Category%20Movement%20Group.xml b/bt5/erp5_base/PortalTypeTemplateItem/portal_types/Split%20Category%20Movement%20Group.xml new file mode 100644 index 0000000000000000000000000000000000000000..efcd362aee4d2ff3d99b2452d287670dde46276b --- /dev/null +++ b/bt5/erp5_base/PortalTypeTemplateItem/portal_types/Split%20Category%20Movement%20Group.xml @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="ERP5TypeInformation" module="Products.ERP5Type.ERP5Type"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>acquire_local_roles</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>content_icon</string> </key> + <value> <string>document_icon.gif</string> </value> + </item> + <item> + <key> <string>content_meta_type</string> </key> + <value> <string>ERP5 Split Category Movement Group</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string> The purpose of MovementGroup is to define how movements are grouped,\n + and how values are updated from simulation movements.\n +</string> </value> + </item> + <item> + <key> <string>factory</string> </key> + <value> <string>addSplitCategoryMovementGroup</string> </value> + </item> + <item> + <key> <string>filter_content_types</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>group_list</string> </key> + <value> + <tuple> + <string>movement_group</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Split Category Movement Group</string> </value> + </item> + <item> + <key> <string>init_script</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>permission</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_base/PortalTypeTemplateItem/portal_types/Split%20Property%20Movement%20Group.xml b/bt5/erp5_base/PortalTypeTemplateItem/portal_types/Split%20Property%20Movement%20Group.xml new file mode 100644 index 0000000000000000000000000000000000000000..746206917e91a4c0f4dbf111a9fdc04e5319b863 --- /dev/null +++ b/bt5/erp5_base/PortalTypeTemplateItem/portal_types/Split%20Property%20Movement%20Group.xml @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="ERP5TypeInformation" module="Products.ERP5Type.ERP5Type"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>acquire_local_roles</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>content_icon</string> </key> + <value> <string>document_icon.gif</string> </value> + </item> + <item> + <key> <string>content_meta_type</string> </key> + <value> <string>ERP5 Split Property Movement Group</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string> The purpose of MovementGroup is to define how movements are grouped,\n + and how values are updated from simulation movements.\n +</string> </value> + </item> + <item> + <key> <string>factory</string> </key> + <value> <string>addSplitPropertyMovementGroup</string> </value> + </item> + <item> + <key> <string>filter_content_types</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>group_list</string> </key> + <value> + <tuple> + <string>movement_group</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Split Property Movement Group</string> </value> + </item> + <item> + <key> <string>init_script</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>permission</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_base/bt/revision b/bt5/erp5_base/bt/revision index dd9de55003996a93508b35e10097f762d422e3cf..9251196df347629db89caa8098b7b3316365f168 100644 --- a/bt5/erp5_base/bt/revision +++ b/bt5/erp5_base/bt/revision @@ -1 +1 @@ -677 \ No newline at end of file +678 \ No newline at end of file diff --git a/bt5/erp5_base/bt/template_action_path_list b/bt5/erp5_base/bt/template_action_path_list index b647c748e86a79145d4372636e5fcc8c6c68e7e9..7a574098f698e7a8773434a9ea222c2499d97003 100644 --- a/bt5/erp5_base/bt/template_action_path_list +++ b/bt5/erp5_base/bt/template_action_path_list @@ -79,7 +79,9 @@ Root Applied Rule Causality Movement Group | view Rounding Model | predicate_view Rounding Model | view Rounding Tool | view +Split Category Movement Group | view Split Movement Group | view +Split Property Movement Group | view Tax Line Delivery Movement Group | view Telephone | change_function Telephone | view diff --git a/bt5/erp5_base/bt/template_portal_type_allowed_content_type_list b/bt5/erp5_base/bt/template_portal_type_allowed_content_type_list index 942c87e5a6630ab3f2547637bfc32818063d2f7f..3efe3cf54e3ad62f78f7a743fbf268b1a5a5fed4 100644 --- a/bt5/erp5_base/bt/template_portal_type_allowed_content_type_list +++ b/bt5/erp5_base/bt/template_portal_type_allowed_content_type_list @@ -19,7 +19,9 @@ Delivery Builder | Property Movement Group Delivery Builder | Quantity Sign Movement Group Delivery Builder | Requirement Movement Group Delivery Builder | Root Applied Rule Causality Movement Group +Delivery Builder | Split Category Movement Group Delivery Builder | Split Movement Group +Delivery Builder | Split Property Movement Group Delivery Builder | Tax Line Delivery Movement Group Delivery Builder | Title Movement Group Delivery Builder | Variant Movement Group @@ -39,7 +41,9 @@ Order Builder | Property Movement Group Order Builder | Quantity Sign Movement Group Order Builder | Requirement Movement Group Order Builder | Root Applied Rule Causality Movement Group +Order Builder | Split Category Movement Group Order Builder | Split Movement Group +Order Builder | Split Property Movement Group Order Builder | Title Movement Group Order Builder | Variant Movement Group Order Builder | Variation Property Movement Group diff --git a/bt5/erp5_base/bt/template_portal_type_id_list b/bt5/erp5_base/bt/template_portal_type_id_list index 8167d7dda0f62144a8f6beb7b71a0e66131dce06..45cd8d105ce3f5d8106fa56cc8e6d70527690aef 100644 --- a/bt5/erp5_base/bt/template_portal_type_id_list +++ b/bt5/erp5_base/bt/template_portal_type_id_list @@ -48,7 +48,9 @@ Role Definition Root Applied Rule Causality Movement Group Rounding Model Rounding Tool +Split Category Movement Group Split Movement Group +Split Property Movement Group Tax Line Delivery Movement Group Telephone Title Movement Group diff --git a/product/ERP5/Document/SplitCategoryMovementGroup.py b/product/ERP5/Document/SplitCategoryMovementGroup.py new file mode 100644 index 0000000000000000000000000000000000000000..846284ffee05e7757c9d0a05a544fe0ae2636897 --- /dev/null +++ b/product/ERP5/Document/SplitCategoryMovementGroup.py @@ -0,0 +1,58 @@ +############################################################################## +# +# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsibility of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# guarantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################## + +from Products.ERP5.Document.CategoryMovementGroup import CategoryMovementGroup + +class SplitCategoryMovementGroup(CategoryMovementGroup): + """ + Split Category Movement Group is similar to Category Movement Group, + but it does grouping only by specified category values and do not + update documents. + + This is useful for acquired properties like payment_condition_*. + """ + meta_type = 'ERP5 Split Category Movement Group' + portal_type = 'Split Category Movement Group' + + def _getPropertyDict(self, movement, **kw): + property_dict = {} + for prop in self.getTestedPropertyList(): + property_dict['_%s_list' % prop] = sorted( + movement.getPropertyList(prop)) + return property_dict + + def test(self, document, property_dict, property_list=None, **kw): + if property_list not in (None, []): + target_property_list = [x for x in self.getTestedPropertyList() \ + if x in property_list] + else: + target_property_list = self.getTestedPropertyList() + for prop in target_property_list: + if property_dict['_%s_list' % prop] != \ + sorted(document.getPropertyList(prop, None)): + return False, property_dict + return True, property_dict diff --git a/product/ERP5/Document/SplitPropertyMovementGroup.py b/product/ERP5/Document/SplitPropertyMovementGroup.py new file mode 100644 index 0000000000000000000000000000000000000000..b0c10dddc885570c4febdcb23df4d7d0d4b76f00 --- /dev/null +++ b/product/ERP5/Document/SplitPropertyMovementGroup.py @@ -0,0 +1,56 @@ +############################################################################## +# +# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsibility of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# guarantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################## + +from Products.ERP5.Document.PropertyMovementGroup import PropertyMovementGroup + +class SplitPropertyMovementGroup(PropertyMovementGroup): + """ + Split Property Movement Group is similar to Property Movement Group, + but it does grouping only by specified property values and do not + update documents. + + This is useful for acquired properties like payment_condition_*. + """ + meta_type = 'ERP5 Split Property Movement Group' + portal_type = 'Split Property Movement Group' + + def _getPropertyDict(self, movement, **kw): + property_dict = {} + for prop in self.getTestedPropertyList(): + property_dict['_%s' % prop] = movement.getProperty(prop, None) + return property_dict + + def test(self, document, property_dict, property_list=None, **kw): + if property_list not in (None, []): + target_property_list = [x for x in self.getTestedPropertyList() \ + if x in property_list] + else: + target_property_list = self.getTestedPropertyList() + for prop in target_property_list: + if property_dict['_%s' % prop] != document.getProperty(prop, None): + return False, property_dict + return True, property_dict