~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to stock_schedule/schedule.py

UF-73: [FIX] Fixed a bug on monthly next date computation
UF-73: [IMP] Improved tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
                i = 0
102
102
                while i < 32 and not test:
103
103
                    i += 1
104
 
                    field = 'monthly_day%s' %str(i)
 
104
                    if i <10:
 
105
                        field = 'monthly_day0%s' %str(i)
 
106
                    else:
 
107
                        field = 'monthly_day%s' %str(i)
105
108
                    if field in data and data.get(field, False):
106
109
                        test = True
107
110
                if not test:
288
291
                    if frequence_read[f]:
289
292
                        days_ok.append(int(f[-2:]))
290
293
                
291
 
                while next_date.day not in days_ok:
 
294
                while next_date.day not in days_ok or next_date < today():
292
295
                    next_date = next_date + RelativeDate(days=+1)
293
296
                    
294
297
                return next_date