Commit 996704f0 authored by Guillaume Michon's avatar Guillaume Michon

Made amortisation method location more explicit


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6068 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 54ddf21d
......@@ -881,20 +881,20 @@ class ImmobilisableItem(XMLObject, Amount):
# 'annuity_start_date': annuity_start_date,
})
try:
ratio_script = self.unrestrictedTraverse('portal_skins/%s' % amortisation_method).ratioCalculation
ratio_script = self.unrestrictedTraverse(amortisation_method).ratioCalculation
except KeyError:
LOG('ERP5 Warning :', 0,
'Unable to find the ratio calculation script %s for item %s at date %s' % (
'portal_skins/%s/ratioCalculation' % amortisation_method, self.getRelativeUrl(), repr(at_date)))
'%s/ratioCalculation' % amortisation_method, self.getRelativeUrl(), repr(at_date)))
raise ImmobilisationCalculationError, \
'Unable to find the ratio calculation script %s for item %s at date %s' % (
'portal_skins/%s/ratioCalculation' % amortisation_method, self.getRelativeUrl(), repr(at_date))
'%s/ratioCalculation' % amortisation_method, self.getRelativeUrl(), repr(at_date))
current_ratio = ratio_script(**ratio_params)
if current_ratio is None:
LOG("ERP5 Warning :",0,
"Unable to calculate the ratio during the amortisation calculation on item %s at date %s : script %s returned None" % (
self.getRelativeUrl(), repr(at_date), 'portal_skins/%s/ratioCalculation' % amortisation_method))
self.getRelativeUrl(), repr(at_date), '%s/ratioCalculation' % amortisation_method))
LOG('params were ', 0, ratio_params)
raise ImmobilisationCalculationError, \
"Unable to calculate the ratio during the amortisation calculation on item %s at date %s" % (
......
......@@ -43,7 +43,7 @@ from zLOG import LOG
UNIMMOBILISING_METHOD = "unimmobilise"
NO_CHANGE_METHOD = "no_change"
AMORTISATION_METHOD_PREFIX = "erp5_accounting_"
AMORTISATION_METHOD_PREFIX = "portal_skins/erp5_accounting_"
IMMOBILISATION_NEEDED_PROPERTY_LIST = [
("date", "stop_date", "Date"),
("method", "amortisation_method", "Amortisation Method"),
......@@ -270,7 +270,7 @@ class ImmobilisationMovement(Movement, XMLObject):
parameter_dict[parameter] = None
amortisation_method = self.getActualAmortisationMethodForItem(item, **kw)
if amortisation_method not in (None, NO_CHANGE_METHOD, UNIMMOBILISING_METHOD, ""):
parameter_object = self.restrictedTraverse(AMORTISATION_METHOD_PREFIX + amortisation_method)
parameter_object = self.unrestrictedTraverse(AMORTISATION_METHOD_PREFIX + amortisation_method)
if parameter_object is not None:
for parameter in parameter_list:
parameter_dict[parameter] = getattr(parameter_object, parameter, None)
......
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