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
...@@ -57,14 +57,6 @@ class AmortisationRule(Rule): ...@@ -57,14 +57,6 @@ class AmortisationRule(Rule):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) 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', movement_name_dict = { 'immobilisation': { 'immo': 'start_immo',
'amo': 'start_amo', 'amo': 'start_amo',
'vat': 'start_vat', 'vat': 'start_vat',
...@@ -125,8 +117,6 @@ class AmortisationRule(Rule): ...@@ -125,8 +117,6 @@ class AmortisationRule(Rule):
setter = getattr(simulation_movement, setter_name) setter = getattr(simulation_movement, setter_name)
setter(value) setter(value)
simulation_movement.edit(start_date=simulation_movement.getStopDate()) simulation_movement.edit(start_date=simulation_movement.getStopDate())
if set_ratio:
simulation_movement.setDefaultDeliveryProperties()
#simulation_movement.immediateReindexObject() #simulation_movement.immediateReindexObject()
return modified_properties return modified_properties
......
...@@ -48,14 +48,6 @@ class DeliveryRule(Rule): ...@@ -48,14 +48,6 @@ class DeliveryRule(Rule):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
# Simulation workflow # Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand') security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule, delivery_movement_type_list=None, **kw): def expand(self, applied_rule, delivery_movement_type_list=None, **kw):
......
...@@ -51,14 +51,6 @@ class InvoiceRule(DeliveryRule): ...@@ -51,14 +51,6 @@ class InvoiceRule(DeliveryRule):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'isAccountable') 'isAccountable')
def isAccountable(self, movement): def isAccountable(self, movement):
......
...@@ -52,14 +52,6 @@ class InvoiceTransactionRule(Rule, PredicateMatrix): ...@@ -52,14 +52,6 @@ class InvoiceTransactionRule(Rule, PredicateMatrix):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
#### Helper method for expand #### Helper method for expand
def _generatePrevisionList(self, applied_rule, **kw): def _generatePrevisionList(self, applied_rule, **kw):
""" """
......
...@@ -49,14 +49,6 @@ class InvoicingRule(Rule): ...@@ -49,14 +49,6 @@ class InvoicingRule(Rule):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'isAccountable') 'isAccountable')
def isAccountable(self, movement): def isAccountable(self, movement):
......
...@@ -47,15 +47,6 @@ class OpenOrderRule(DeliveryRule): ...@@ -47,15 +47,6 @@ class OpenOrderRule(DeliveryRule):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
# Simulation workflow # Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand') security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule, force=0, **kw): def expand(self, applied_rule, force=0, **kw):
......
...@@ -48,15 +48,6 @@ class OrderRule(DeliveryRule): ...@@ -48,15 +48,6 @@ class OrderRule(DeliveryRule):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.AppliedRule
)
# Simulation workflow # Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand') security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule, force=0, **kw): def expand(self, applied_rule, force=0, **kw):
......
...@@ -51,14 +51,6 @@ class PaymentRule(Rule): ...@@ -51,14 +51,6 @@ class PaymentRule(Rule):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
receivable_account_type_list = ('asset/receivable', ) receivable_account_type_list = ('asset/receivable', )
payable_account_type_list = ('liability/payable', ) payable_account_type_list = ('liability/payable', )
......
...@@ -51,15 +51,6 @@ class ProductionOrderModelRule(TransformationModelRuleMixin, OrderRule): ...@@ -51,15 +51,6 @@ class ProductionOrderModelRule(TransformationModelRuleMixin, OrderRule):
__implements = ( interfaces.IPredicate, __implements = ( interfaces.IPredicate,
interfaces.IRule ) interfaces.IRule )
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.AppliedRule
)
# Simulation workflow # Simulation workflow
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'_getExpandablePropertyDict') '_getExpandablePropertyDict')
......
...@@ -52,15 +52,6 @@ class ProductionOrderRule(OrderRule): ...@@ -52,15 +52,6 @@ class ProductionOrderRule(OrderRule):
__implements = ( interfaces.IPredicate, __implements = ( interfaces.IPredicate,
interfaces.IRule ) interfaces.IRule )
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.AppliedRule
)
# Simulation workflow # Simulation workflow
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'_getExpandablePropertyDict') '_getExpandablePropertyDict')
......
...@@ -86,6 +86,7 @@ class Rule(Predicate, XMLObject): ...@@ -86,6 +86,7 @@ class Rule(Predicate, XMLObject):
, PropertySheet.Predicate , PropertySheet.Predicate
, PropertySheet.Reference , PropertySheet.Reference
, PropertySheet.Version , PropertySheet.Version
, PropertySheet.Rule
) )
# Portal Type of created children # Portal Type of created children
......
...@@ -43,14 +43,6 @@ class TaxRule(DeliveryRule): ...@@ -43,14 +43,6 @@ class TaxRule(DeliveryRule):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
security.declareProtected(Permissions.ModifyPortalContent, 'expand') security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule, force=0, **kw): def expand(self, applied_rule, force=0, **kw):
""" """ """ """
......
...@@ -48,15 +48,6 @@ class TradeModelRule(TransformationRule): ...@@ -48,15 +48,6 @@ class TradeModelRule(TransformationRule):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) 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): def _getMovementDictByBusinessPath(self, movement, business_path_list):
"""Sets Business Path's provided values""" """Sets Business Path's provided values"""
if len(business_path_list) > 1: if len(business_path_list) > 1:
......
...@@ -220,13 +220,6 @@ class TransformationModelRule(TransformationModelRuleMixin, Rule): ...@@ -220,13 +220,6 @@ class TransformationModelRule(TransformationModelRuleMixin, Rule):
zope.interface.implements(interfaces.IPredicate, zope.interface.implements(interfaces.IPredicate,
interfaces.IRule ) interfaces.IRule )
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
def getFactory(self): def getFactory(self):
return TransformationModelMovementFactory() return TransformationModelMovementFactory()
......
...@@ -53,13 +53,7 @@ class TransformationRule(TransformationSourcingRuleMixin, Rule): ...@@ -53,13 +53,7 @@ class TransformationRule(TransformationSourcingRuleMixin, Rule):
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
zope.interface.implements(interfaces.IPredicate, zope.interface.implements(interfaces.IPredicate,
interfaces.IRule ) interfaces.IRule )
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
# Class variable # Class variable
simulation_movement_portal_type = "Simulation Movement" simulation_movement_portal_type = "Simulation Movement"
......
...@@ -63,13 +63,7 @@ class TransformationSourcingModelRule(TransformationModelRuleMixin, Rule): ...@@ -63,13 +63,7 @@ class TransformationSourcingModelRule(TransformationModelRuleMixin, Rule):
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
zope.interface.implements(interfaces.IPredicate, zope.interface.implements(interfaces.IPredicate,
interfaces.IRule ) interfaces.IRule )
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
def getFactory(self): def getFactory(self):
return SourcingMovementFactory() return SourcingMovementFactory()
......
...@@ -142,13 +142,7 @@ class TransformationSourcingRule(TransformationSourcingRuleMixin, Rule): ...@@ -142,13 +142,7 @@ class TransformationSourcingRule(TransformationSourcingRuleMixin, Rule):
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
zope.interface.implements(interfaces.IPredicate, zope.interface.implements(interfaces.IPredicate,
interfaces.IRule ) interfaces.IRule )
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
)
# Class variable # Class variable
simulation_movement_portal_type = "Simulation Movement" simulation_movement_portal_type = "Simulation Movement"
......
...@@ -50,12 +50,6 @@ class AppliedRule: ...@@ -50,12 +50,6 @@ class AppliedRule:
'type' : 'string', 'type' : 'string',
'mode' : 'w' }, 'mode' : 'w' },
{ 'id' : 'expandable_property',
'description' : 'List of properties used in expand',
'type' : 'lines',
'default' : [],
'multivalued' : 1,
'mode' : 'w' },
) )
_categories = ('specialise', 'causality', 'order', ) _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