Commit bc35f1ab authored by Łukasz Nowak's avatar Łukasz Nowak

- create PropertySheet for Rule classes

 - move expandable_property from AppliedRule to Rule property sheet
 - associate Rule (*not* AppliedRule) property sheet with Rule document
 - as Zope uses magic to fill automatically property_sheets list there is not need to repeat it in subclasses


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28462 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cc0c74ca
......@@ -56,14 +56,6 @@ class AmortisationRule(Rule):
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
movement_name_dict = { 'immobilisation': { 'immo': 'start_immo',
'amo': 'start_amo',
......@@ -125,8 +117,6 @@ class AmortisationRule(Rule):
setter = getattr(simulation_movement, setter_name)
setter(value)
simulation_movement.edit(start_date=simulation_movement.getStopDate())
if set_ratio:
simulation_movement.setDefaultDeliveryProperties()
#simulation_movement.immediateReindexObject()
return modified_properties
......
......@@ -48,14 +48,6 @@ class DeliveryRule(Rule):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
# Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule, delivery_movement_type_list=None, **kw):
......
......@@ -51,14 +51,6 @@ class InvoiceRule(DeliveryRule):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
security.declareProtected(Permissions.AccessContentsInformation,
'isAccountable')
def isAccountable(self, movement):
......
......@@ -52,14 +52,6 @@ class InvoiceTransactionRule(Rule, PredicateMatrix):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
#### Helper method for expand
def _generatePrevisionList(self, applied_rule, **kw):
"""
......
......@@ -49,14 +49,6 @@ class InvoicingRule(Rule):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
security.declareProtected(Permissions.AccessContentsInformation,
'isAccountable')
def isAccountable(self, movement):
......
......@@ -46,15 +46,6 @@ class OpenOrderRule(DeliveryRule):
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
# Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
......
......@@ -47,15 +47,6 @@ class OrderRule(DeliveryRule):
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.AppliedRule
)
# Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
......
......@@ -51,14 +51,6 @@ class PaymentRule(Rule):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
receivable_account_type_list = ('asset/receivable', )
payable_account_type_list = ('liability/payable', )
......
......@@ -51,15 +51,6 @@ class ProductionOrderModelRule(TransformationModelRuleMixin, OrderRule):
__implements = ( interfaces.IPredicate,
interfaces.IRule )
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.AppliedRule
)
# Simulation workflow
security.declareProtected(Permissions.AccessContentsInformation,
'_getExpandablePropertyDict')
......
......@@ -52,15 +52,6 @@ class ProductionOrderRule(OrderRule):
__implements = ( interfaces.IPredicate,
interfaces.IRule )
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.AppliedRule
)
# Simulation workflow
security.declareProtected(Permissions.AccessContentsInformation,
'_getExpandablePropertyDict')
......
......@@ -86,6 +86,7 @@ class Rule(Predicate, XMLObject):
, PropertySheet.Predicate
, PropertySheet.Reference
, PropertySheet.Version
, PropertySheet.Rule
)
# Portal Type of created children
......
......@@ -42,14 +42,6 @@ class TaxRule(DeliveryRule):
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule, force=0, **kw):
......
......@@ -48,15 +48,6 @@ class TradeModelRule(TransformationRule):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.AppliedRule
)
def _getMovementDictByBusinessPath(self, movement, business_path_list):
"""Sets Business Path's provided values"""
if len(business_path_list) > 1:
......
......@@ -220,13 +220,6 @@ class TransformationModelRule(TransformationModelRuleMixin, Rule):
zope.interface.implements(interfaces.IPredicate,
interfaces.IRule )
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
def getFactory(self):
return TransformationModelMovementFactory()
......
......@@ -53,13 +53,7 @@ class TransformationRule(TransformationSourcingRuleMixin, Rule):
security.declareObjectProtected(Permissions.AccessContentsInformation)
zope.interface.implements(interfaces.IPredicate,
interfaces.IRule )
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
# Class variable
simulation_movement_portal_type = "Simulation Movement"
......
......@@ -63,13 +63,7 @@ class TransformationSourcingModelRule(TransformationModelRuleMixin, Rule):
security.declareObjectProtected(Permissions.AccessContentsInformation)
zope.interface.implements(interfaces.IPredicate,
interfaces.IRule )
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
def getFactory(self):
return SourcingMovementFactory()
......
......@@ -142,13 +142,7 @@ class TransformationSourcingRule(TransformationSourcingRuleMixin, Rule):
security.declareObjectProtected(Permissions.AccessContentsInformation)
zope.interface.implements(interfaces.IPredicate,
interfaces.IRule )
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
# Class variable
simulation_movement_portal_type = "Simulation Movement"
......
......@@ -50,12 +50,6 @@ class AppliedRule:
'type' : 'string',
'mode' : 'w' },
{ 'id' : 'expandable_property',
'description' : 'List of properties used in expand',
'type' : 'lines',
'default' : [],
'multivalued' : 1,
'mode' : 'w' },
)
_categories = ('specialise', 'causality', 'order', )
##############################################################################
#
# Copyright (c) 2009 Nexedi SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability 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
# garantees 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
class Rule:
"""
Property sheet for Rule class and subclass instances
"""
_properties = (
{ 'id' : 'expandable_property',
'description' : 'List of properties used in expand',
'type' : 'lines',
'default' : [],
'multivalued' : 1,
'mode' : 'w' },
)
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