[REM] mass_mailing: removed create_template wizard, not used anymore
authorThibault Delavallée <tde@openerp.com>
Tue, 8 Apr 2014 11:33:16 +0000 (13:33 +0200)
committerThibault Delavallée <tde@openerp.com>
Tue, 8 Apr 2014 11:33:16 +0000 (13:33 +0200)
bzr revid: tde@openerp.com-20140408113316-sqwjz3al6xk5kohf

addons/mass_mailing/__openerp__.py
addons/mass_mailing/wizard/__init__.py
addons/mass_mailing/wizard/create_template.py [deleted file]
addons/mass_mailing/wizard/create_template_view.xml [deleted file]

index 0ea2894..5c69859 100644 (file)
@@ -43,7 +43,6 @@ professional emails and reuse templates in a few clicks.
         'data/mail_data.xml',
         'data/mass_mailing_data.xml',
         'wizard/mail_compose_message_view.xml',
-        'wizard/create_template_view.xml',
         'wizard/test_mailing.xml',
         'wizard/mailing_list_confirm.xml',
         'views/mass_mailing_report.xml',
index 9784de7..6a8e9b9 100644 (file)
@@ -1,6 +1,5 @@
 # -*- coding: utf-8 -*-
 
-import create_template
 import test_mailing
 import mail_compose_message
-import mailing_list_confirm
\ No newline at end of file
+import mailing_list_confirm
diff --git a/addons/mass_mailing/wizard/create_template.py b/addons/mass_mailing/wizard/create_template.py
deleted file mode 100644 (file)
index 420102c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from openerp.osv import osv, fields
-
-
-class EmailTemplateWizard(osv.TransientModel):
-    """A wizard allowing to create an email.template from a mass mailing. This wizard
-    allows to simplify and direct the user in the creation of its template without
-    having to tune or hack the email.template model. """
-    _name = 'mailing.email.template.wizard'
-
-    def default_get(self, cr, uid, fields, context=None):
-        res = super(EmailTemplateWizard, self).default_get(cr, uid, fields, context=context)
-        if res.get('mass_mailing_id') and not 'name' in res:
-            mailing_ng = self.pool['mail.mass_mailing'].name_get(cr, uid, [res.get('mass_mailing_id')], context=context)
-            res['name'] = mailing_ng[0][1]
-        return res
-
-    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),
-        'body': fields.html('Body'),
-        'template_id': fields.many2one('email.template', 'Basis Template'),
-        'mass_mailing_id': fields.many2one('mail.mass_mailing', 'Mass Mailing', required=True),
-        'attachment_ids': fields.many2many(
-            'ir.attachment', 'email_template_wizard_attachment_rel', 'email_template_id',
-            'attachment_id', 'Attachments'),
-    }
-
-    def on_change_template_id(self, cr, uid, ids, template_id, context=None):
-        if template_id:
-            template = self.pool['email.template'].browse(cr, uid, template_id, context=context)
-            return {'value': {'body': template.body_html, 'attachment_ids': [(4, att.id) for att in template.attachment_ids]}}
-        return {}
-
-    def create_template(self, cr, uid, ids, context=None):
-        EmailTemplate = self.pool['email.template']
-        for wizard in self.browse(cr, uid, ids, context=context):
-            model_ids = self.pool['ir.model'].search(cr, uid, [('model', '=', wizard.mass_mailing_id.mailing_model)], context=context)
-            values = {
-                'name': wizard.name,
-                'model_id': model_ids[0],
-                'body_html': wizard.body,
-                'use_in_mass_mailing': True,
-                'use_default_to': True,
-                'attachment_ids': [(4, attach.id) for attach in wizard.attachment_ids],
-            }
-            tpl_id = EmailTemplate.create(cr, uid, values, context=context)
-            self.pool['mail.mass_mailing'].write(cr, uid, [wizard.mass_mailing_id.id], {'template_id': tpl_id}, context=context)
-        return {
-            'type': 'ir.actions.act_window',
-            'view_type': 'form',
-            'view_mode': 'form',
-            'res_model': 'mail.mass_mailing',
-            'res_id': wizard.mass_mailing_id.id,
-            'target': 'current',
-            'context': context,
-        }
diff --git a/addons/mass_mailing/wizard/create_template_view.xml b/addons/mass_mailing/wizard/create_template_view.xml
deleted file mode 100644 (file)
index dd2f288..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0"?>
-<openerp>
-    <data>
-
-        <record model="ir.ui.view" id="view_mailing_email_template_form">
-            <field name="name">mailing.email.template.wizard.form</field>
-            <field name="model">mailing.email.template.wizard</field>
-            <field name="arch" type="xml">
-                <form string="Mass Mailing Template" version="7.0">
-                    <group>
-                        <group>
-                            <field name="name"/>
-                            <field name="mass_mailing_id" invisible="1"/>
-                            <field name="template_id" invisible="1"
-                                on_change="on_change_template_id(template_id, context)"/>
-                        </group>
-                        <group>
-                            <div class="oe_right oe_button_box" name="buttons">
-                                <button name="%(email_template.wizard_email_template_preview)d" string="Preview"
-                                    type="action" target="new"
-                                    context="{'template_id':active_id}"/>
-                            </div>
-                        </group>
-                    </group>
-                    <notebook>
-                        <page string="Body">
-                            <field name="body" nolabel="1"/>
-                            <field name="attachment_ids" widget="many2many_binary"/>
-                        </page>
-                    </notebook>
-                    <footer>
-                        <button string="Create" name="create_template" type="object" class="oe_highlight"/>
-                        or
-                        <button string="Cancel" class="oe_link" special="cancel" />
-                    </footer>
-                </form>
-            </field>
-        </record>
-
-        <record id="action_mailing_email_template" model="ir.actions.act_window">
-            <field name="name">Mass Mailing Template</field>
-            <field name="res_model">mailing.email.template.wizard</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">form</field>
-            <field name="target">new</field>
-        </record>
-
-    </data>
-</openerp>