|
@ -43,7 +43,7 @@ class DateRangeGenerator(models.TransientModel): |
|
|
count=self.count+1) |
|
|
count=self.count+1) |
|
|
vals = list(vals) |
|
|
vals = list(vals) |
|
|
date_ranges = [] |
|
|
date_ranges = [] |
|
|
month_digits = len(unicode(self.count)) |
|
|
|
|
|
|
|
|
count_digits = len(unicode(self.count)) |
|
|
for idx, dt_start in enumerate(vals[:-1]): |
|
|
for idx, dt_start in enumerate(vals[:-1]): |
|
|
date_start = fields.Date.to_string(dt_start.date()) |
|
|
date_start = fields.Date.to_string(dt_start.date()) |
|
|
# always remove 1 day for the date_end since range limits are |
|
|
# always remove 1 day for the date_end since range limits are |
|
@ -51,9 +51,8 @@ class DateRangeGenerator(models.TransientModel): |
|
|
dt_end = vals[idx+1].date() - relativedelta(days=1) |
|
|
dt_end = vals[idx+1].date() - relativedelta(days=1) |
|
|
date_end = fields.Date.to_string(dt_end) |
|
|
date_end = fields.Date.to_string(dt_end) |
|
|
date_ranges.append({ |
|
|
date_ranges.append({ |
|
|
'name': '%s%s' % ( |
|
|
|
|
|
self.name_prefix, |
|
|
|
|
|
unicode(idx + 1).zfill(month_digits)), |
|
|
|
|
|
|
|
|
'name': '%s%0*d' % ( |
|
|
|
|
|
self.name_prefix, count_digits, idx + 1), |
|
|
'date_start': date_start, |
|
|
'date_start': date_start, |
|
|
'date_end': date_end, |
|
|
'date_end': date_end, |
|
|
'type_id': self.type_id.id, |
|
|
'type_id': self.type_id.id, |
|
|