Commit 00c4a1f3 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

MonthlyRangeMovementGroup: set an appropriate time offset at the end of month.

parent 5340aacb
Pipeline #8480 failed with stage
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
############################################################################## ##############################################################################
from erp5.component.document.MovementGroup import MovementGroup from erp5.component.document.MovementGroup import MovementGroup
from DateTime import DateTime
from Products.ERP5Type.DateUtils import atTheEndOfPeriod from Products.ERP5Type.DateUtils import atTheEndOfPeriod
...@@ -48,7 +49,9 @@ class MonthlyRangeMovementGroup(MovementGroup): ...@@ -48,7 +49,9 @@ class MonthlyRangeMovementGroup(MovementGroup):
for property_name in self.getTestedPropertyList() or ('start_date', 'stop_date'): for property_name in self.getTestedPropertyList() or ('start_date', 'stop_date'):
date = movement.getProperty(property_name, None) date = movement.getProperty(property_name, None)
if date is not None: if date is not None:
end_of_month = atTheEndOfPeriod(date, 'month')-1 # wrap atTheEndOfPeriod value with DateTime(value..strftime('%Y/%m/%d')) so that
# it returns a value with an appropriate time offset at that date.
end_of_month = DateTime((atTheEndOfPeriod(date, 'month')-0.5).strftime('%Y/%m/%d'))
property_dict[property_name] = end_of_month property_dict[property_name] = end_of_month
return property_dict return property_dict
......
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