[TYPO] mass_mailing: rename wrongly named function field (dayly -> daily).
[FIX] mass_mailing: add `oldname` attribute to some renamed fields. [FIX] mass_mailing: replace int field with many2one field to enforce fkey bzr revid: chs@openerp.com-20140429165430-6w4xplwr4c5ymi1j
This commit is contained in:
parent
525b47510d
commit
f38387820d
|
@ -271,9 +271,9 @@ class MassMailing(osv.Model):
|
|||
date_begin_str = date_begin.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
date_end_str = date_end.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
domain = [('mass_mailing_id', '=', mailing.id), ('opened', '>=', date_begin_str), ('opened', '<=', date_end_str)]
|
||||
res[mailing.id]['opened_dayly'] = json.dumps(self.__get_bar_values(cr, uid, obj, domain, ['opened'], 'opened_count', 'opened:day', date_begin, context=context))
|
||||
res[mailing.id]['opened_daily'] = json.dumps(self.__get_bar_values(cr, uid, obj, domain, ['opened'], 'opened_count', 'opened:day', date_begin, context=context))
|
||||
domain = [('mass_mailing_id', '=', mailing.id), ('replied', '>=', date_begin_str), ('replied', '<=', date_end_str)]
|
||||
res[mailing.id]['replied_dayly'] = json.dumps(self.__get_bar_values(cr, uid, obj, domain, ['replied'], 'replied_count', 'replied:day', date_begin, context=context))
|
||||
res[mailing.id]['replied_daily'] = json.dumps(self.__get_bar_values(cr, uid, obj, domain, ['replied'], 'replied_count', 'replied:day', date_begin, context=context))
|
||||
return res
|
||||
|
||||
def _get_statistics(self, cr, uid, ids, name, arg, context=None):
|
||||
|
@ -314,7 +314,7 @@ class MassMailing(osv.Model):
|
|||
'name': fields.char('Subject', required=True),
|
||||
'email_from': fields.char('From', required=True),
|
||||
'create_date': fields.datetime('Creation Date'),
|
||||
'sent_date': fields.datetime('Sent Date'),
|
||||
'sent_date': fields.datetime('Sent Date', oldname='date'),
|
||||
'body_html': fields.html('Body'),
|
||||
'attachment_ids': fields.many2many(
|
||||
'ir.attachment', 'mass_mailing_ir_attachments_rel',
|
||||
|
@ -340,7 +340,7 @@ class MassMailing(osv.Model):
|
|||
'reply_to': fields.char('Reply To', help='Preferred Reply-To Address'),
|
||||
# recipients
|
||||
'mailing_model': fields.selection(_mailing_model, string='Recipients Model', required=True),
|
||||
'mailing_domain': fields.char('Domain'),
|
||||
'mailing_domain': fields.char('Domain', oldname='domain'),
|
||||
'contact_list_ids': fields.many2many(
|
||||
'mail.mass_mailing.list', 'mail_mass_mailing_list_rel',
|
||||
string='Mailing Lists',
|
||||
|
@ -398,16 +398,14 @@ class MassMailing(osv.Model):
|
|||
_get_statistics, string='Replied Ratio',
|
||||
type='integer', multi='_get_statistics',
|
||||
),
|
||||
# dayly ratio
|
||||
'opened_dayly': fields.function(
|
||||
# daily ratio
|
||||
'opened_daily': fields.function(
|
||||
_get_daily_statistics, string='Opened',
|
||||
type='char', multi='_get_daily_statistics',
|
||||
oldname='opened_monthly',
|
||||
),
|
||||
'replied_dayly': fields.function(
|
||||
'replied_daily': fields.function(
|
||||
_get_daily_statistics, string='Replied',
|
||||
type='char', multi='_get_daily_statistics',
|
||||
oldname='replied_monthly',
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -19,23 +19,8 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from datetime import datetime
|
||||
from dateutil import relativedelta
|
||||
import random
|
||||
try:
|
||||
import simplejson as json
|
||||
except ImportError:
|
||||
import json
|
||||
import urllib
|
||||
import urlparse
|
||||
|
||||
from openerp import tools
|
||||
from openerp.exceptions import Warning
|
||||
from openerp.tools.safe_eval import safe_eval as eval
|
||||
from openerp.tools.translate import _
|
||||
from openerp.osv import osv, fields
|
||||
|
||||
|
||||
class MailMailStats(osv.Model):
|
||||
""" MailMailStats models the statistics collected about emails. Those statistics
|
||||
are stored in a separated model and table to avoid bloating the mail_mail table
|
||||
|
@ -48,11 +33,7 @@ class MailMailStats(osv.Model):
|
|||
_order = 'message_id'
|
||||
|
||||
_columns = {
|
||||
'mail_mail_id': fields.integer(
|
||||
'Mail ID',
|
||||
help='ID of the related mail_mail. This field is an integer field because'
|
||||
'the related mail_mail can be deleted separately from its statistics.'
|
||||
),
|
||||
'mail_mail_id': fields.many2one('mail.mail', 'Mail ID', ondelete='set null'),
|
||||
'message_id': fields.char('Message-ID'),
|
||||
'model': fields.char('Document model'),
|
||||
'res_id': fields.integer('Document ID'),
|
||||
|
@ -106,4 +87,3 @@ class MailMailStats(osv.Model):
|
|||
stat_ids = self._get_ids(cr, uid, ids, mail_mail_ids, mail_message_ids, [('bounced', '=', False)], context)
|
||||
self.write(cr, uid, stat_ids, {'bounced': fields.datetime.now()}, context=context)
|
||||
return stat_ids
|
||||
|
||||
|
|
|
@ -208,11 +208,11 @@
|
|||
</button>
|
||||
<button name="%(action_view_mass_mailing_contacts)d"
|
||||
type="action" class="oe_stat_button oe_inline">
|
||||
<field name="opened_dayly" string="Opened Daily" widget="barchart"/>
|
||||
<field name="opened_daily" string="Opened Daily" widget="barchart"/>
|
||||
</button>
|
||||
<button name="%(action_view_mass_mailing_contacts)d"
|
||||
type="action" class="oe_stat_button oe_inline">
|
||||
<field name="replied_dayly" string="Replied Daily" widget="barchart"/>
|
||||
<field name="replied_daily" string="Replied Daily" widget="barchart"/>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oe_button_box" attrs="{'invisible': [('total', '=', 0)]}" style="margin-bottom: 32px">
|
||||
|
|
Loading…
Reference in New Issue