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