Commit 26a870d9 authored by Nicolas Delaby's avatar Nicolas Delaby

Caluculate duration with accouting consideration

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17177 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0a207996
...@@ -629,7 +629,7 @@ class ImmobilisableItem(XMLObject, Amount): ...@@ -629,7 +629,7 @@ class ImmobilisableItem(XMLObject, Amount):
initial_duration = immo_period.get('initial_duration',0) initial_duration = immo_period.get('initial_duration',0)
stop_date = immo_period.get('stop_date', at_date) stop_date = immo_period.get('stop_date', at_date)
calculate = 1 calculate = 1
consumpted_duration = getRoundedMonthBetween(initial_date, stop_date) consumpted_duration = getRoundedMonthBetween(initial_date, stop_date, True)
remaining_duration = initial_duration - consumpted_duration remaining_duration = initial_duration - consumpted_duration
if remaining_duration < 0: if remaining_duration < 0:
returned_value = 0 returned_value = 0
...@@ -698,8 +698,8 @@ class ImmobilisableItem(XMLObject, Amount): ...@@ -698,8 +698,8 @@ class ImmobilisableItem(XMLObject, Amount):
stop_durability = 0 stop_durability = 0
consumpted_durability = start_durability - stop_durability consumpted_durability = start_durability - stop_durability
consumpted_time = getRoundedMonthBetween(start_date, stop_date) consumpted_time = getRoundedMonthBetween(start_date, stop_date, True)
current_consumpted_time = getRoundedMonthBetween(start_date, at_date) current_consumpted_time = getRoundedMonthBetween(start_date, at_date, True)
if consumpted_time <= 0 or current_consumpted_time <= 0: if consumpted_time <= 0 or current_consumpted_time <= 0:
return start_durability return start_durability
else: else:
......
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