Commit f2fe551d authored by Jérome Perrin's avatar Jérome Perrin

make RulesTool inherit from BaseTool


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37412 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1a84d03d
...@@ -26,19 +26,15 @@ ...@@ -26,19 +26,15 @@
# #
############################################################################## ##############################################################################
from Products.CMFCore.utils import UniqueObject from Products.ERP5Type.Tool.BaseTool import BaseTool
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Globals import InitializeClass, DTMLFile from Products.ERP5Type.Globals import InitializeClass, DTMLFile
from Products.ERP5Type.Core.Folder import Folder
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5 import _dtmldir from Products.ERP5 import _dtmldir
from zLOG import LOG class RuleTool(BaseTool):
class RuleTool (UniqueObject, Folder):
""" """
The RulesTool implements portal object The RulesTool implements portal object
transformation policies. transformation policies.
...@@ -76,52 +72,22 @@ class RuleTool (UniqueObject, Folder): ...@@ -76,52 +72,22 @@ class RuleTool (UniqueObject, Folder):
according to templates. Allows to parametrize modules according to templates. Allows to parametrize modules
such as payroll. such as payroll.
Try to mimic: XSL semantics
Status : OK
NEW NAME : Rules Tool
TODO: XXX Please use BaseTool
""" """
id = 'portal_rules' id = 'portal_rules'
meta_type = 'ERP5 Rule Tool' meta_type = 'ERP5 Rule Tool'
portal_type = 'Rule Tool' portal_type = 'Rule Tool'
allowed_types = ( 'ERP5 Order Rule', 'ERP5 Transformation Rule', 'ERP5 Zero Stock Rule', 'ERP5 Delivery Rule', 'ERP5 Amortisation Rule') allowed_types = ( 'ERP5 Order Rule', 'ERP5 Transformation Rule',
'ERP5 Zero Stock Rule', 'ERP5 Delivery Rule',
'ERP5 Amortisation Rule')
# Declarative Security # Declarative Security
security = ClassSecurityInfo() security = ClassSecurityInfo()
#
# ZMI methods
#
manage_options = ( ( { 'label' : 'Overview'
, 'action' : 'manage_overview'
}
,
)
+ Folder.manage_options
)
security.declareProtected( Permissions.ManagePortal, 'manage_overview' ) security.declareProtected( Permissions.ManagePortal, 'manage_overview' )
manage_overview = DTMLFile( 'explainRuleTool', _dtmldir ) manage_overview = DTMLFile( 'explainRuleTool', _dtmldir )
# Filter content (ZMI))
def __init__(self):
return Folder.__init__(self, RuleTool.id)
# Filter content (ZMI))
def filtered_meta_types(self, user=None):
# Filters the list of available meta types.
all = RuleTool.inheritedAttribute('filtered_meta_types')(self)
meta_types = []
for meta_type in self.all_meta_types():
if meta_type['name'] in self.allowed_types:
meta_types.append(meta_type)
return meta_types
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'searchRuleList') 'searchRuleList')
def searchRuleList(self, movement, tested_base_category_list=None, **kw): def searchRuleList(self, movement, tested_base_category_list=None, **kw):
""" """
this method searches for rules, as predicates against movement this method searches for rules, as predicates against movement
......
<dtml-var manage_page_header> <dtml-var manage_page_header>
<dtml-var manage_tabs> <dtml-var manage_tabs>
<p>Explain SumulationTool</p> <p>Rule Tool contains Rules</p>
<dtml-var manage_page_footer> <dtml-var manage_page_footer>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment