[IMP] mass_mailing: create wizard: do not inherit from

mailing list anymore, just have the necessary fields to simplify

bzr revid: tde@openerp.com-20140331110626-iewarhctoyoaucsg
This commit is contained in:
Thibault Delavallée
2014-03-31 13:06:26 +02:00
parent 3855f056c7
commit e0134a2bfa
+20 -2
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from openerp.osv import osv
from openerp.osv import osv, fields
from openerp.tools.translate import _
@@ -9,11 +9,28 @@ class MailingListWizard(osv.TransientModel):
allows to simplify and direct the user in the creation of its template without
having to tune or hack the email.template model. """
_name = 'mail.mass_mailing.list.create'
_inherit = 'mail.mass_mailing.list'
def _get_model_list(self, cr, uid, context=None):
return self.pool['mail.mass_mailing']._get_mailing_model(cr, uid, context=context)
# indirections for inheritance
_model_list = lambda self, *args, **kwargs: self._get_model_list(*args, **kwargs)
_columns = {
'name': fields.char('Name', required=True),
'model': fields.selection(
_model_list, type='char', required=True,
string='Applies To'
),
}
def action_new_list(self, cr, uid, ids, context=None):
wizard = self.browse(cr, uid, ids[0], context=context)
action_id = self.pool['mail.mass_mailing']._get_model_to_list_action_id(cr, uid, wizard.model, context=context)
if wizard.model == 'mail.mass_mailing.contact':
domain = [('list_id', '=', False)]
else:
domain = []
ctx = dict(context, search_default_not_opt_out=True, view_manager_highlight=[action_id], default_name=wizard.name, default_model=wizard.model)
return {
'name': _('Choose Recipients'),
@@ -22,4 +39,5 @@ class MailingListWizard(osv.TransientModel):
'view_mode': 'tree,form',
'res_model': wizard.model,
'context': ctx,
'domain': domain,
}