[Erp5-report] r28087 - /erp5/trunk/products/ERP5/Document/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Jul 16 10:09:00 CEST 2009
Author: jerome
Date: Thu Jul 16 10:08:59 2009
New Revision: 28087
URL: http://svn.erp5.org?rev=28087&view=rev
Log:
protect methods with AccessContentsInformation, not View
simplify some constructions
don't accept id_only=1 in getImmobilisationState, it's not part of workflow state getter API
Modified:
erp5/trunk/products/ERP5/Document/ImmobilisableItem.py
erp5/trunk/products/ERP5/Document/ImmobilisationDelivery.py
erp5/trunk/products/ERP5/Document/ImmobilisationMovement.py
Modified: erp5/trunk/products/ERP5/Document/ImmobilisableItem.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/ImmobilisableItem.py?rev=28087&r1=28086&r2=28087&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/ImmobilisableItem.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/ImmobilisableItem.py [utf8] Thu Jul 16 10:08:59 2009
@@ -79,7 +79,8 @@
, PropertySheet.Amortisation
)
- security.declareProtected(Permissions.View, 'getImmobilisationRelatedMovementList')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getImmobilisationRelatedMovementList')
def getImmobilisationRelatedMovementList(self,
from_date = None,
to_date = None,
@@ -213,10 +214,11 @@
return None
return organisation
- security.declareProtected(Permissions.View, 'getImmobilisationMovementValueList')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getImmobilisationMovementValueList')
def getImmobilisationMovementValueList(self,
from_date=None,
- to_date=None,
+ to_date=None,
filter_valid=1,
**kw):
"""
@@ -230,7 +232,8 @@
immobilisation_and_owner_change=1,
**kw)
- security.declareProtected(Permissions.View, 'getUnfilteredImmobilisationMovementValueList')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getUnfilteredImmobilisationMovementValueList')
def getUnfilteredImmobilisationMovementValueList(self, from_date=None, to_date=None, **kw):
"""
Returns a list of immobilisation applied to the current item from date to date
@@ -240,7 +243,8 @@
to_date=to_date,
filter_valid=0, **kw)
- security.declareProtected(Permissions.View, 'getPastImmobilisationMovementValueList')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getPastImmobilisationMovementValueList')
def getPastImmobilisationMovementValueList(self, from_date=None, at_date=None, **kw):
"""
Returns a list of immobilisation movements applied to current item
@@ -251,7 +255,8 @@
to_date=at_date, **kw )
return result
- security.declareProtected(Permissions.View, 'getFutureImmobilisationMovementValueList')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getFutureImmobilisationMovementValueList')
def getFutureImmobilisationMovementValueList(self, to_date=None, at_date=None, from_movement=None, **kw):
"""
Returns a list of immobilisation movements applied to current item
@@ -267,7 +272,8 @@
return result
- security.declareProtected(Permissions.View, 'getLastImmobilisationMovementValue')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getLastImmobilisationMovementValue')
def getLastImmobilisationMovementValue(self, at_date=None, **kw):
"""
Returns the last immobilisation movement before the given date, or now
@@ -277,7 +283,8 @@
return past_list[-1]
return None
- security.declareProtected(Permissions.View, 'getNextImmobilisationMovementValue')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getNextImmobilisationMovementValue')
def getNextImmobilisationMovementValue(self, at_date=None, from_movement=None, **kw):
"""
Returns the first immobilisation movement after the given date, or now
@@ -292,7 +299,8 @@
return future_list[0]
return None
- security.declareProtected(Permissions.View, 'getImmobilisationPeriodList')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getImmobilisationPeriodList')
def getImmobilisationPeriodList(self, from_date=None, to_date=None, **kw):
"""
Returns a list of dictionaries representing immobilisation periods for the object
@@ -587,7 +595,8 @@
tuple([(key,kw[key]) for key in kw_key_list]) ] = immo_period_list
return immo_period_list
- security.declareProtected(Permissions.View, 'getLastImmobilisationPeriod')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getLastImmobilisationPeriod')
def getLastImmobilisationPeriod(self, to_date=None, **kw):
"""
Returns the current immobilisation period, or the last one if the
@@ -599,18 +608,21 @@
return None
return period_list[-1]
- security.declareProtected(Permissions.View, 'isCurrentlyImmobilised')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'isCurrentlyImmobilised')
def isCurrentlyImmobilised(self, **kw):
""" Returns true if the item is immobilised at this time """
return self.isImmobilised(at_date = DateTime(), **kw)
- security.declareProtected(Permissions.View, 'isNotCurrentlyImmobilised')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'isNotCurrentlyImmobilised')
def isNotCurrentlyImmobilised(self, **kw):
""" Returns true if the item is not immobilised at this time """
return not self.isCurrentlyImmobilised(**kw)
- security.declareProtected(Permissions.View, 'isImmobilised')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'isImmobilised')
def isImmobilised(self, at_date=None, **kw):
"""
Returns true if the item is immobilised at the given date.
@@ -627,14 +639,16 @@
return 0
return 1
- security.declareProtected(Permissions.View, 'getCurrentRemainingAmortisationDuration')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getCurrentRemainingAmortisationDuration')
def getCurrentRemainingAmortisationDuration(self, **kw):
""" Returns the calculated remaining amortisation duration for this item
at the current time.
"""
return self.getRemainingAmortisationDuration(at_date=DateTime(), **kw)
- security.declareProtected(Permissions.View, 'getRemainingAmortisationDuration')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getRemainingAmortisationDuration')
def getRemainingAmortisationDuration(self, at_date=None, **kw):
"""
Returns the calculated remaining amortisation duration for the item.
@@ -663,7 +677,8 @@
return int(remaining_duration)
return None
- security.declareProtected(Permissions.View, 'getRemainingDurability')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getRemainingDurability')
def getRemainingDurability(self, at_date=None, **kw):
"""
Returns the durability of the item at the given date, or now.
@@ -735,7 +750,8 @@
return start_durability - consumpted_durability * current_consumpted_time / consumpted_time
- security.declareProtected(Permissions.View, 'getCurrentRemainingDurability')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getCurrentRemainingDurability')
def getCurrentRemainingDurability(self, **kw):
"""
Returns the remaining durability at the current date
@@ -743,7 +759,8 @@
return self.getRemainingDurability(at_date=DateTime(), **kw)
- security.declareProtected(Permissions.View, 'getAmortisationPrice')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getAmortisationPrice')
def getAmortisationPrice(self, at_date=None, with_currency=0, **kw):
"""
Returns the deprecated value of item at given date, or now.
@@ -992,13 +1009,13 @@
return '%0.2f %s' % (returned_price, currency)
return returned_price
- security.declareProtected(Permissions.View, 'getCurrentAmortisationPrice')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getCurrentAmortisationPrice')
def getCurrentAmortisationPrice(self, with_currency=0, **kw):
""" Returns the deprecated value of item at current time """
return self.getAmortisationPrice(at_date=DateTime(),
with_currency=with_currency, **kw)
- security.declareProtected(Permissions.ModifyPortalContent, '_createAmortisationRule')
def _createAmortisationRule(self):
"""
Build or update the amortisation rule related to this item, then expand the rule
@@ -1033,7 +1050,8 @@
# It is time to expand it
my_applied_rule.expand()
- security.declareProtected(Permissions.View, 'expandAmortisation')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'expandAmortisation')
def expandAmortisation(self,**kw):
"""
Calculate the amortisation annuities for the item
@@ -1052,7 +1070,8 @@
after_tag='expand_amortisation'
).immediateExpandAmortisation()
- security.declareProtected(Permissions.View, 'immediateExpandAmortisation')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'immediateExpandAmortisation')
def immediateExpandAmortisation(self):
"""
Calculate the amortisation annuities for the item
@@ -1068,7 +1087,7 @@
delivery.updateImmobilisationState()
self.activate().expandAmortisation(activate_kw=activate_kw)
- security.declareProtected(Permissions.View, 'getSectionMovementValueList')
+ security.declareProtected(Permissions.AccessContentsInformation, 'getSectionMovementValueList')
def getSectionMovementValueList(self, include_to_date=0, **kw):
"""
Return the list of successive movements affecting
@@ -1102,7 +1121,7 @@
movement_list.append(movement)
return movement_list
- security.declareProtected(Permissions.View, 'getSectionChangeList')
+ security.declareProtected(Permissions.AccessContentsInformation, 'getSectionChangeList')
def getSectionChangeList(self, at_date=None, **kw):
"""
Return the list of successive owners of the item with
@@ -1134,7 +1153,7 @@
'movement' : movement } )
return owner_list
- security.declareProtected(Permissions.View, 'getSectionValue')
+ security.declareProtected(Permissions.AccessContentsInformation, 'getSectionValue')
def getSectionValue(self, at_date=None, **kw):
"""
Return the owner of the item at the given date
@@ -1145,7 +1164,7 @@
return owner_list[-1]['owner']
return None
- security.declareProtected(Permissions.View, 'getCurrentSectionValue')
+ security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentSectionValue')
def getCurrentSectionValue(self, **kw):
"""
Return the current owner of the item
Modified: erp5/trunk/products/ERP5/Document/ImmobilisationDelivery.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/ImmobilisationDelivery.py?rev=28087&r1=28086&r2=28087&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/ImmobilisationDelivery.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/ImmobilisationDelivery.py [utf8] Thu Jul 16 10:08:59 2009
@@ -77,7 +77,7 @@
, PropertySheet.Reference
)
- security.declareProtected(Permissions.View, 'updateImmobilisationState')
+ security.declareProtected(Permissions.AccessContentsInformation, 'updateImmobilisationState')
def updateImmobilisationState(self, **kw):
"""
This is often called as an activity, it will check if the
@@ -94,7 +94,7 @@
except ImmobilisationValidityError:
self.calculateImmobilisationValidity()
- security.declareProtected(Permissions.View, 'getImmobilisationMovementList')
+ security.declareProtected(Permissions.AccessContentsInformation, 'getImmobilisationMovementList')
def getImmobilisationMovementList(self, **kw):
"""
Return regular movements + immobilisation movements like
@@ -103,7 +103,7 @@
return self.getMovementList(self.getPortalMovementTypeList() +
('Immobilisation Line', 'Immobilisation Cell'), **kw)
- security.declareProtected(Permissions.View, 'checkImmobilisationConsistency')
+ security.declareProtected(Permissions.AccessContentsInformation, 'checkImmobilisationConsistency')
def checkImmobilisationConsistency(self, *args, **kw):
"""
Check the consistency about immobilisation values
@@ -113,24 +113,23 @@
return_list.extend(movement.checkImmobilisationConsistency())
return return_list
- security.declareProtected(Permissions.View, 'isValidImmobilisationMovement')
+ security.declareProtected(Permissions.AccessContentsInformation, 'isValidImmobilisationMovement')
def isValidImmobilisationMovement(self, *args, **kw):
"""
Return true if all submovements are valid in terms of immobilisation
"""
error_list = self.checkImmobilisationConsistency(*args, **kw)
- if len(error_list) == 0:
- return 1
- return 0
+ return len(error_list) == 0
- security.declareProtected(Permissions.View, 'isInvalidImmobilisationMovement')
+ security.declareProtected(Permissions.AccessContentsInformation, 'isInvalidImmobilisationMovement')
def isInvalidImmobilisationMovement(self, *args, **kw):
"""
Return false if all submovements are valid in terms of immobilisation
"""
return not self.isValidImmobilisationMovement(*args, **kw)
- security.declareProtected(Permissions.View, 'getAggregatedItemsNextImmobilisationMovementValueList')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getAggregatedItemsNextImmobilisationMovementValueList')
def getAggregatedItemsNextImmobilisationMovementValueList(self, **kw):
"""
Return the list of each next immobilisation movement for each aggregated item
Modified: erp5/trunk/products/ERP5/Document/ImmobilisationMovement.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/ImmobilisationMovement.py?rev=28087&r1=28086&r2=28087&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/ImmobilisationMovement.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/ImmobilisationMovement.py [utf8] Thu Jul 16 10:08:59 2009
@@ -229,16 +229,17 @@
return errors
- security.declareProtected(Permissions.View, 'checkImmobilisationConsistency')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'checkImmobilisationConsistency')
def checkImmobilisationConsistency(self, *args, **kw):
"""
Checks the consistency about immobilisation values
"""
- return_value = self._checkImmobilisationConsistency(*args, **kw)
- return return_value
-
-
- security.declareProtected(Permissions.View, 'getAmortisationMethodParameter')
+ return self._checkImmobilisationConsistency(*args, **kw)
+
+
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getAmortisationMethodParameter')
def getAmortisationMethodParameter(self, parameter_list, **kw):
"""
Returns a dictionary containing the value of each parameter
@@ -251,7 +252,8 @@
return self.getAmortisationMethodParameterForItem(None, parameter_list, **kw)
- security.declareProtected(Permissions.View, 'getAmortisationMethodParameterForItem')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getAmortisationMethodParameterForItem')
def getAmortisationMethodParameterForItem(self, item, parameter_list, split_char=None, split_qty=3, **kw):
"""
Returns a dictionary containing the value of each parameter
@@ -299,7 +301,8 @@
return parameter_dict
- security.declareProtected(Permissions.View, 'getActualAmortisationMethodForItem')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getActualAmortisationMethodForItem')
def getActualAmortisationMethodForItem(self, item, **kw):
"""
Returns the actual amortisation method by getting the previous
@@ -322,7 +325,8 @@
return None
- security.declareProtected(Permissions.View, 'getNeededSpecificParameterListForItem')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getNeededSpecificParameterListForItem')
def getNeededSpecificParameterListForItem(self, item, **kw):
"""
Returns the list of specific parameters which are
@@ -335,7 +339,8 @@
**kw)["needed_specific_parameter_list"]
- security.declareProtected(Permissions.View, 'getUncontinuousNeededSpecificParameterListForItem')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getUncontinuousNeededSpecificParameterListForItem')
def getUncontinuousNeededSpecificParameterListForItem(self, item, **kw):
"""
Returns the list of specific parameters which are
@@ -349,7 +354,8 @@
**kw)["uncontinuous_needed_specific_parameter_list"]
- security.declareProtected(Permissions.View, 'getFacultativeSpecificParameterListForItem')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getFacultativeSpecificParameterListForItem')
def getFacultativeSpecificParameterListForItem(self, item, **kw):
"""
Returns the list of specific parameters which are
@@ -362,18 +368,19 @@
**kw)["facultative_specific_parameter_list"]
- security.declareProtected(Permissions.View, 'isUsingAmortisationMethod')
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'isUsingAmortisationMethod')
def isUsingAmortisationMethod(self, method):
"""
Return true if this item is using the given method
"""
- if self.getAmortisationMethod() == method:
- return 1
- return 0
-
- security.declareProtected(Permissions.View, 'getImmobilisationState')
- def getImmobilisationState(self, id_only=1):
+ return self.getAmortisationMethod() == method
+
+ security.declareProtected(Permissions.AccessContentsInformation,
+ 'getImmobilisationState')
+ def getImmobilisationState(self):
"""
Return root delivery immobilisation state
"""
return self.getRootDeliveryValue().getImmobilisationState()
+
More information about the Erp5-report
mailing list