[FIX] mass_mailing: still fixing issues due to read_group update
done in saas-3. Indeed it now returns a date or datetime depending on the field type whether before saas-3 only a date was returned. bzr revid: odo@openerp.com-20140219123505-7lvstb3x9mdv0gr0
This commit is contained in:
parent
4821fad601
commit
035ad13316
|
@ -168,8 +168,10 @@ class MassMailing(osv.Model):
|
|||
'tooltip': (date_begin + relativedelta.relativedelta(days=i)).strftime('%d %B %Y'),
|
||||
} for i in range(0, self._period_number)]
|
||||
group_obj = obj.read_group(cr, uid, domain, read_fields, groupby_field, context=context)
|
||||
field_col_info = obj._all_columns.get(groupby_field.split(':')[0])
|
||||
pattern = tools.DEFAULT_SERVER_DATE_FORMAT if field_col_info.column._type == 'date' else tools.DEFAULT_SERVER_DATETIME_FORMAT
|
||||
for group in group_obj:
|
||||
group_begin_date = datetime.strptime(group['__domain'][0][2], tools.DEFAULT_SERVER_DATE_FORMAT).date()
|
||||
group_begin_date = datetime.strptime(group['__domain'][0][2], pattern).date()
|
||||
timedelta = relativedelta.relativedelta(group_begin_date, date_begin)
|
||||
section_result[timedelta.days] = {'value': group.get(value_field, 0), 'tooltip': group.get(groupby_field)}
|
||||
return section_result
|
||||
|
|
Loading…
Reference in New Issue