[FIX]base_action_rule: complete date time if date_field contains only a date

bzr revid: nco@tinyerp.com-20111227092700-g5tl9um3ufo8jyne
This commit is contained in:
Yannick Vaucher@Camptocamp 2011-12-27 14:57:00 +05:30 committed by Nimesh (Open ERP)
parent bc4f3aac14
commit b8efbcf9d8
1 changed files with 6 additions and 0 deletions

View File

@ -31,6 +31,12 @@ import tools
def get_datetime(date_field):
'''Return a datetime from a date string or a datetime string'''
#complete date time if date_field contains only a date
date_split = date_field.split(' ')
if len(date_split) == 1:
date_field = date_split[0] + " 00:00:00"
return datetime.strptime(date_field[:19], '%Y-%m-%d %H:%M:%S')