summaryrefslogtreecommitdiff
path: root/addons/email_template
diff options
context:
space:
mode:
authorchm@openerp.com <>2014-04-23 17:48:52 +0200
committerchm@openerp.com <>2014-04-23 17:48:52 +0200
commitee7ff4bd07d8d84ed2ebb0e2e3f5eb437f158e5b (patch)
tree25577845139d390f9bf27e0237d18842aeace02b /addons/email_template
parentb1bc68d8eb374f30173e03e8048d1c3588a00d4b (diff)
parent1657ffb8e7d95ef5f94e59121737abb068371b66 (diff)
[MERGE] from trunk
bzr revid: chm@openerp.com-20140423154852-gzegxqrzb2sj01zl
Diffstat (limited to 'addons/email_template')
-rw-r--r--addons/email_template/__openerp__.py2
-rw-r--r--addons/email_template/email_template.py53
-rw-r--r--addons/email_template/email_template_view.xml74
-rw-r--r--addons/email_template/i18n/ar.po4
-rw-r--r--addons/email_template/i18n/bg.po4
-rw-r--r--addons/email_template/i18n/bs.po4
-rw-r--r--addons/email_template/i18n/ca.po4
-rw-r--r--addons/email_template/i18n/cs.po4
-rw-r--r--addons/email_template/i18n/da.po4
-rw-r--r--addons/email_template/i18n/de.po4
-rw-r--r--addons/email_template/i18n/en_GB.po4
-rw-r--r--addons/email_template/i18n/es.po4
-rw-r--r--addons/email_template/i18n/es_CL.po4
-rw-r--r--addons/email_template/i18n/es_CR.po4
-rw-r--r--addons/email_template/i18n/es_EC.po4
-rw-r--r--addons/email_template/i18n/et.po4
-rw-r--r--addons/email_template/i18n/fa_AF.po4
-rw-r--r--addons/email_template/i18n/fi.po4
-rw-r--r--addons/email_template/i18n/fr.po4
-rw-r--r--addons/email_template/i18n/he.po4
-rw-r--r--addons/email_template/i18n/hr.po4
-rw-r--r--addons/email_template/i18n/hu.po4
-rw-r--r--addons/email_template/i18n/it.po4
-rw-r--r--addons/email_template/i18n/ja.po4
-rw-r--r--addons/email_template/i18n/lt.po4
-rw-r--r--addons/email_template/i18n/mk.po4
-rw-r--r--addons/email_template/i18n/mn.po4
-rw-r--r--addons/email_template/i18n/nb.po4
-rw-r--r--addons/email_template/i18n/nl.po4
-rw-r--r--addons/email_template/i18n/nl_BE.po4
-rw-r--r--addons/email_template/i18n/pl.po4
-rw-r--r--addons/email_template/i18n/pt.po4
-rw-r--r--addons/email_template/i18n/pt_BR.po4
-rw-r--r--addons/email_template/i18n/ro.po4
-rw-r--r--addons/email_template/i18n/ru.po4
-rw-r--r--addons/email_template/i18n/sl.po4
-rw-r--r--addons/email_template/i18n/sr.po4
-rw-r--r--addons/email_template/i18n/sr@latin.po4
-rw-r--r--addons/email_template/i18n/sv.po4
-rw-r--r--addons/email_template/i18n/tr.po4
-rw-r--r--addons/email_template/i18n/zh_CN.po4
-rw-r--r--addons/email_template/i18n/zh_TW.po4
-rw-r--r--addons/email_template/res_partner_demo.yml9
-rw-r--r--addons/email_template/tests/test_mail.py22
-rw-r--r--addons/email_template/wizard/email_template_preview.py3
-rw-r--r--addons/email_template/wizard/email_template_preview_view.xml15
-rw-r--r--addons/email_template/wizard/mail_compose_message.py69
-rw-r--r--addons/email_template/wizard/mail_compose_message_view.xml16
48 files changed, 205 insertions, 214 deletions
diff --git a/addons/email_template/__openerp__.py b/addons/email_template/__openerp__.py
index b7977660134..298754c8b8c 100644
--- a/addons/email_template/__openerp__.py
+++ b/addons/email_template/__openerp__.py
@@ -63,7 +63,7 @@ campaigns on any OpenERP document.
'wizard/mail_compose_message_view.xml',
'security/ir.model.access.csv'
],
- 'demo': ['res_partner_demo.yml'],
+ 'demo': [],
'installable': True,
'auto_install': True,
'images': ['images/1_email_account.jpeg','images/2_email_template.jpeg','images/3_emails.jpeg'],
diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py
index 3f0fad1c8a0..dd9ed49d3ef 100644
--- a/addons/email_template/email_template.py
+++ b/addons/email_template/email_template.py
@@ -231,6 +231,11 @@ class email_template(osv.osv):
'email_from': fields.char('From',
help="Sender address (placeholders may be used here). If not set, the default "
"value will be the author's email alias if configured, or email address."),
+ 'use_default_to': fields.boolean(
+ 'Default recipients',
+ help="Default recipients of the record:\n"
+ "- partner (using id on a partner or the partner_id field) OR\n"
+ "- email (using email_from or email field)"),
'email_to': fields.char('To (Emails)', help="Comma-separated recipient addresses (placeholders may be used here)"),
'partner_to': fields.char('To (Partners)',
help="Comma-separated ids of recipient partners (placeholders may be used here)",
@@ -386,6 +391,37 @@ class email_template(osv.osv):
})
return {'value': result}
+ def generate_recipients_batch(self, cr, uid, results, template_id, res_ids, context=None):
+ """Generates the recipients of the template. Default values can ben generated
+ instead of the template values if requested by template or context.
+ Emails (email_to, email_cc) can be transformed into partners if requested
+ in the context. """
+ if context is None:
+ context = {}
+ template = self.browse(cr, uid, template_id, context=context)
+
+ if template.use_default_to or context.get('tpl_force_default_to'):
+ ctx = dict(context, thread_model=template.model)
+ default_recipients = self.pool['mail.thread'].message_get_default_recipients(cr, uid, res_ids, context=ctx)
+ for res_id, recipients in default_recipients.iteritems():
+ results[res_id].pop('partner_to', None)
+ results[res_id].update(recipients)
+
+ for res_id, values in results.iteritems():
+ partner_ids = values.get('partner_ids', list())
+ if context and context.get('tpl_partners_only'):
+ mails = tools.email_split(values.pop('email_to', '')) + tools.email_split(values.pop('email_cc', ''))
+ for mail in mails:
+ partner_id = self.pool.get('res.partner').find_or_create(cr, uid, mail, context=context)
+ partner_ids.append(partner_id)
+ partner_to = values.pop('partner_to', '')
+ if partner_to:
+ # placeholders could generate '', 3, 2 due to some empty field values
+ tpl_partner_ids = [pid for pid in partner_to.split(',') if pid]
+ partner_ids += self.pool['res.partner'].exists(cr, SUPERUSER_ID, tpl_partner_ids, context=context)
+ results[res_id]['partner_ids'] = partner_ids
+ return results
+
def generate_email_batch(self, cr, uid, template_id, res_ids, context=None, fields=None):
"""Generates an email from the template for given the given model based on
records given by res_ids.
@@ -420,14 +456,18 @@ class email_template(osv.osv):
context=context)
for res_id, field_value in generated_field_values.iteritems():
results.setdefault(res_id, dict())[field] = field_value
+ # compute recipients
+ results = self.generate_recipients_batch(cr, uid, results, template.id, template_res_ids, context=context)
# update values for all res_ids
for res_id in template_res_ids:
values = results[res_id]
+ # body: add user signature, sanitize
if 'body_html' in fields and template.user_signature:
signature = self.pool.get('res.users').browse(cr, uid, uid, context).signature
values['body_html'] = tools.append_content_to_html(values['body_html'], signature)
if values.get('body_html'):
values['body'] = tools.html_sanitize(values['body_html'])
+ # technical settings
values.update(
mail_server_id=template.mail_server_id.id or False,
auto_delete=template.auto_delete,
@@ -484,17 +524,8 @@ class email_template(osv.osv):
# create a mail_mail based on values, without attachments
values = self.generate_email(cr, uid, template_id, res_id, context=context)
if not values.get('email_from'):
- raise osv.except_osv(_('Warning!'),_("Sender email is missing or empty after template rendering. Specify one to deliver your message"))
- # process partner_to field that is a comma separated list of partner_ids -> recipient_ids
- # NOTE: only usable if force_send is True, because otherwise the value is
- # not stored on the mail_mail, and therefore lost -> fixed in v8
- values['recipient_ids'] = []
- partner_to = values.pop('partner_to', '')
- if partner_to:
- # placeholders could generate '', 3, 2 due to some empty field values
- tpl_partner_ids = [pid for pid in partner_to.split(',') if pid]
- values['recipient_ids'] += [(4, pid) for pid in self.pool['res.partner'].exists(cr, SUPERUSER_ID, tpl_partner_ids, context=context)]
-
+ raise osv.except_osv(_('Warning!'), _("Sender email is missing or empty after template rendering. Specify one to deliver your message"))
+ values['recipient_ids'] = [(4, pid) for pid in values.get('partner_ids', list())]
attachment_ids = values.pop('attachment_ids', [])
attachments = values.pop('attachments', [])
msg_id = mail_mail.create(cr, uid, values, context=context)
diff --git a/addons/email_template/email_template_view.xml b/addons/email_template/email_template_view.xml
index 4f7828cb531..6dda3e97571 100644
--- a/addons/email_template/email_template_view.xml
+++ b/addons/email_template/email_template_view.xml
@@ -9,8 +9,10 @@
<sheet>
<div class="oe_title">
<label for="name" class="oe_edit_only"/><h1><field name="name" required="1"/></h1>
- <label for="model_id"/><field name="model_id" required="1" on_change="onchange_model_id(model_id)" class="oe_inline"/>
- <field name="model" invisible="1"/>
+ <group>
+ <field name="model_id" required="1" on_change="onchange_model_id(model_id)"/>
+ <field name="model" invisible="1"/>
+ </group>
</div>
<div class="oe_right oe_button_box" name="buttons">
<field name="ref_ir_act_window" invisible="1"/>
@@ -25,42 +27,27 @@
context="{'template_id':active_id}"/>
</div>
<notebook>
- <page string="Mailing Template">
+ <page string="Content">
+ <label for="subject"/>
+ <h2 style="display: inline-block;"><field name="subject" placeholder="Subject (placeholders may be used here)"/></h2>
+ <field name="body_html"/>
+ <field name="attachment_ids" widget="many2many_binary"/>
+ </page>
+ <page string="Email Configuration">
<group>
- <group>
- <field name="email_from"
- placeholder="Override author's email"/>
- <field name="email_to"
- placeholder="Comma-separated recipient addresses"/>
- <field name="partner_to"
- placeholder="Comma-separated ids of recipient partners"/>
- <field name="email_cc"
- placeholder="Comma-separated carbon copy recipients addresses"/>
- <field name="reply_to"
- placeholder="Preferred reply address"/>
- <field name="subject"
- placeholder="Subject (placeholders may be used here)"/>
- <field name="user_signature" string="Author Signature (mass mail only)"/>
- </group>
- <group class="oe_edit_only">
- <h3 colspan="2">Dynamic placeholder generator</h3>
- <field name="model_object_field"
- domain="[('model_id','=',model_id),('ttype','!=','one2many'),('ttype','!=','many2many')]"
- on_change="onchange_sub_model_object_value_field(model_object_field)"/>
- <field name="sub_object" readonly="1"/>
- <field name="sub_model_object_field"
- domain="[('model_id','=',sub_object),('ttype','!=','one2many'),('ttype','!=','many2many')]"
- attrs="{'readonly':[('sub_object','=',False)],'required':[('sub_object','!=',False)]}"
- on_change="onchange_sub_model_object_value_field(model_object_field,sub_model_object_field)"/>
- <field name="null_value"
- on_change="onchange_sub_model_object_value_field(model_object_field,sub_model_object_field,null_value)"/>
- <field name="copyvalue"/>
- </group>
+ <field name="email_from"
+ placeholder="Override author's email"/>
+ <field name="use_default_to"/>
+ <field name="email_to" attrs="{'invisible': [('use_default_to', '=', True)]}"
+ placeholder="Comma-separated recipient addresses"/>
+ <field name="partner_to" attrs="{'invisible': [('use_default_to', '=', True)]}"
+ placeholder="Comma-separated ids of recipient partners"/>
+ <field name="email_cc" attrs="{'invisible': [('use_default_to', '=', True)]}"
+ placeholder="Comma-separated carbon copy recipients addresses"/>
+ <field name="reply_to"
+ placeholder="Preferred reply address"/>
+ <field name="user_signature" string="Author Signature (mass mail only)"/>
</group>
- <h3>Body</h3>
- <field name="body_html" width="250" height="450"
- placeholder="Rich-text/HTML content of the message (placeholders may be used here)"/>
- <field name="attachment_ids" widget="many2many_binary"/>
</page>
<page string="Advanced Settings">
<group>
@@ -72,6 +59,21 @@
attrs="{'invisible':[('report_template','=',False)]}"/>
</group>
</page>
+ <page string="Dynamic Placeholder Generator">
+ <group>
+ <field name="model_object_field"
+ domain="[('model_id','=',model_id),('ttype','!=','one2many'),('ttype','!=','many2many')]"
+ on_change="onchange_sub_model_object_value_field(model_object_field)"/>
+ <field name="sub_object" readonly="1"/>
+ <field name="sub_model_object_field"
+ domain="[('model_id','=',sub_object),('ttype','!=','one2many'),('ttype','!=','many2many')]"
+ attrs="{'readonly':[('sub_object','=',False)],'required':[('sub_object','!=',False)]}"
+ on_change="onchange_sub_model_object_value_field(model_object_field,sub_model_object_field)"/>
+ <field name="null_value"
+ on_change="onchange_sub_model_object_value_field(model_object_field,sub_model_object_field,null_value)"/>
+ <field name="copyvalue"/>
+ </group>
+ </page>
</notebook>
</sheet>
</form>
diff --git a/addons/email_template/i18n/ar.po b/addons/email_template/i18n/ar.po
index 6667f0f9839..d8971ca9ac1 100644
--- a/addons/email_template/i18n/ar.po
+++ b/addons/email_template/i18n/ar.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/bg.po b/addons/email_template/i18n/bg.po
index 7f6c668e258..e99252cf655 100644
--- a/addons/email_template/i18n/bg.po
+++ b/addons/email_template/i18n/bg.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/bs.po b/addons/email_template/i18n/bs.po
index c37de475204..0a0b7985f73 100644
--- a/addons/email_template/i18n/bs.po
+++ b/addons/email_template/i18n/bs.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/ca.po b/addons/email_template/i18n/ca.po
index 1287f1fbf12..9e8cb2f652b 100644
--- a/addons/email_template/i18n/ca.po
+++ b/addons/email_template/i18n/ca.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/cs.po b/addons/email_template/i18n/cs.po
index 27674071989..fe85698c64a 100644
--- a/addons/email_template/i18n/cs.po
+++ b/addons/email_template/i18n/cs.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/da.po b/addons/email_template/i18n/da.po
index 7ba2917b83a..6682c5ac4bf 100644
--- a/addons/email_template/i18n/da.po
+++ b/addons/email_template/i18n/da.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/de.po b/addons/email_template/i18n/de.po
index 0530b9f4282..808b0478b53 100644
--- a/addons/email_template/i18n/de.po
+++ b/addons/email_template/i18n/de.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/en_GB.po b/addons/email_template/i18n/en_GB.po
index 2b5921f4d10..d80f42824ea 100644
--- a/addons/email_template/i18n/en_GB.po
+++ b/addons/email_template/i18n/en_GB.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:08+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/es.po b/addons/email_template/i18n/es.po
index f41d1827fee..24ab30feae1 100644
--- a/addons/email_template/i18n/es.po
+++ b/addons/email_template/i18n/es.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/es_CL.po b/addons/email_template/i18n/es_CL.po
index 533e4ca0b19..722dbda0a5c 100644
--- a/addons/email_template/i18n/es_CL.po
+++ b/addons/email_template/i18n/es_CL.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:08+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/es_CR.po b/addons/email_template/i18n/es_CR.po
index 2f7da8dc847..084fd7bb549 100644
--- a/addons/email_template/i18n/es_CR.po
+++ b/addons/email_template/i18n/es_CR.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:08+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
"Language: es\n"
#. module: email_template
diff --git a/addons/email_template/i18n/es_EC.po b/addons/email_template/i18n/es_EC.po
index ca6bcc0011c..349b1ddbd5f 100644
--- a/addons/email_template/i18n/es_EC.po
+++ b/addons/email_template/i18n/es_EC.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:08+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/et.po b/addons/email_template/i18n/et.po
index 87f05d9ae6f..804e653ab58 100644
--- a/addons/email_template/i18n/et.po
+++ b/addons/email_template/i18n/et.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/fa_AF.po b/addons/email_template/i18n/fa_AF.po
index fe073eae0e2..5cb76618368 100644
--- a/addons/email_template/i18n/fa_AF.po
+++ b/addons/email_template/i18n/fa_AF.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:08+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/fi.po b/addons/email_template/i18n/fi.po
index 09ee2edd902..c7bbff03a52 100644
--- a/addons/email_template/i18n/fi.po
+++ b/addons/email_template/i18n/fi.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/fr.po b/addons/email_template/i18n/fr.po
index 0b84724b17a..42e57b32015 100644
--- a/addons/email_template/i18n/fr.po
+++ b/addons/email_template/i18n/fr.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/he.po b/addons/email_template/i18n/he.po
index 4be8dab8b14..786acbadf6a 100644
--- a/addons/email_template/i18n/he.po
+++ b/addons/email_template/i18n/he.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/hr.po b/addons/email_template/i18n/hr.po
index 46e09258d6c..5380e1eaa7b 100644
--- a/addons/email_template/i18n/hr.po
+++ b/addons/email_template/i18n/hr.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/hu.po b/addons/email_template/i18n/hu.po
index c299fa680a8..69e32892a2b 100644
--- a/addons/email_template/i18n/hu.po
+++ b/addons/email_template/i18n/hu.po
@@ -13,8 +13,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/it.po b/addons/email_template/i18n/it.po
index 7a5496bf0a1..f6d1970336b 100644
--- a/addons/email_template/i18n/it.po
+++ b/addons/email_template/i18n/it.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/ja.po b/addons/email_template/i18n/ja.po
index 8c146803870..a7d6c22b919 100644
--- a/addons/email_template/i18n/ja.po
+++ b/addons/email_template/i18n/ja.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/lt.po b/addons/email_template/i18n/lt.po
index 7e9307935cc..3f136a0e964 100644
--- a/addons/email_template/i18n/lt.po
+++ b/addons/email_template/i18n/lt.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/mk.po b/addons/email_template/i18n/mk.po
index 0bb18a9835b..66bc42898bd 100644
--- a/addons/email_template/i18n/mk.po
+++ b/addons/email_template/i18n/mk.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/mn.po b/addons/email_template/i18n/mn.po
index 339cdf37ae4..cb047abd19b 100644
--- a/addons/email_template/i18n/mn.po
+++ b/addons/email_template/i18n/mn.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/nb.po b/addons/email_template/i18n/nb.po
index 13328e3859d..53673dccb01 100644
--- a/addons/email_template/i18n/nb.po
+++ b/addons/email_template/i18n/nb.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/nl.po b/addons/email_template/i18n/nl.po
index 2115aa28c0c..5e8572b0368 100644
--- a/addons/email_template/i18n/nl.po
+++ b/addons/email_template/i18n/nl.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/nl_BE.po b/addons/email_template/i18n/nl_BE.po
index 7b9dfedb5f1..76f1c2e8e76 100644
--- a/addons/email_template/i18n/nl_BE.po
+++ b/addons/email_template/i18n/nl_BE.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:08+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/pl.po b/addons/email_template/i18n/pl.po
index 95f550fa7e6..8632ce6bf64 100644
--- a/addons/email_template/i18n/pl.po
+++ b/addons/email_template/i18n/pl.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/pt.po b/addons/email_template/i18n/pt.po
index da50eaa93be..9005315b8d8 100644
--- a/addons/email_template/i18n/pt.po
+++ b/addons/email_template/i18n/pt.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/pt_BR.po b/addons/email_template/i18n/pt_BR.po
index 5ad5de55b94..9041eae8f37 100644
--- a/addons/email_template/i18n/pt_BR.po
+++ b/addons/email_template/i18n/pt_BR.po
@@ -15,8 +15,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:08+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/ro.po b/addons/email_template/i18n/ro.po
index 73e88fcadd5..30a01a4fa95 100644
--- a/addons/email_template/i18n/ro.po
+++ b/addons/email_template/i18n/ro.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/ru.po b/addons/email_template/i18n/ru.po
index d9744f3b809..97fed0bc82a 100644
--- a/addons/email_template/i18n/ru.po
+++ b/addons/email_template/i18n/ru.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:30+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/sl.po b/addons/email_template/i18n/sl.po
index f4c2d3adc03..5dbb60e1dd0 100644
--- a/addons/email_template/i18n/sl.po
+++ b/addons/email_template/i18n/sl.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/sr.po b/addons/email_template/i18n/sr.po
index 1737d9d8e28..2a08bb5280f 100644
--- a/addons/email_template/i18n/sr.po
+++ b/addons/email_template/i18n/sr.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:07+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/sr@latin.po b/addons/email_template/i18n/sr@latin.po
index 01508023b9f..feaa6bd37ca 100644
--- a/addons/email_template/i18n/sr@latin.po
+++ b/addons/email_template/i18n/sr@latin.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:08+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/sv.po b/addons/email_template/i18n/sv.po
index a3cbc34d3b7..a6f73c082d2 100644
--- a/addons/email_template/i18n/sv.po
+++ b/addons/email_template/i18n/sv.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:08+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/tr.po b/addons/email_template/i18n/tr.po
index 9f3f488a8a0..6ef22607386 100644
--- a/addons/email_template/i18n/tr.po
+++ b/addons/email_template/i18n/tr.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:08+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/zh_CN.po b/addons/email_template/i18n/zh_CN.po
index 90bde91c814..c33ed8c44a7 100644
--- a/addons/email_template/i18n/zh_CN.po
+++ b/addons/email_template/i18n/zh_CN.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:08+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/i18n/zh_TW.po b/addons/email_template/i18n/zh_TW.po
index c44240c2658..a6689ba5385 100644
--- a/addons/email_template/i18n/zh_TW.po
+++ b/addons/email_template/i18n/zh_TW.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2014-04-12 08:08+0000\n"
-"X-Generator: Launchpad (build 16976)\n"
+"X-Launchpad-Export-Date: 2014-04-22 07:31+0000\n"
+"X-Generator: Launchpad (build 16985)\n"
#. module: email_template
#: field:email.template,email_from:0
diff --git a/addons/email_template/res_partner_demo.yml b/addons/email_template/res_partner_demo.yml
deleted file mode 100644
index 8eaf48f9e87..00000000000
--- a/addons/email_template/res_partner_demo.yml
+++ /dev/null
@@ -1,9 +0,0 @@
--
- Set opt-out to True on all demo partners
--
- !python {model: res.partner}: |
- partner_ids = self.search(cr, uid, [])
- # assume partners with an external ID come from demo data
- ext_ids = self._get_external_ids(cr, uid, partner_ids)
- ids_to_update = [k for (k,v) in ext_ids.iteritems() if v]
- self.write(cr, uid, ids_to_update, {'opt_out': True}) \ No newline at end of file
diff --git a/addons/email_template/tests/test_mail.py b/addons/email_template/tests/test_mail.py
index 580421fe67e..8bc6d62017c 100644
--- a/addons/email_template/tests/test_mail.py
+++ b/addons/email_template/tests/test_mail.py
@@ -74,7 +74,7 @@ class test_message_compose(TestMail):
# 1. Comment on pigs
compose_id = mail_compose.create(cr, uid,
- {'subject': 'Forget me subject', 'body': '<p>Dummy body</p>', 'post': True},
+ {'subject': 'Forget me subject', 'body': '<p>Dummy body</p>'},
{'default_composition_mode': 'comment',
'default_model': 'mail.group',
'default_res_id': self.group_pigs_id,
@@ -102,7 +102,7 @@ class test_message_compose(TestMail):
'default_template_id': email_template_id,
'active_ids': [self.group_pigs_id, self.group_bird_id]
}
- compose_id = mail_compose.create(cr, uid, {'subject': 'Forget me subject', 'body': 'Dummy body', 'post': True}, context)
+ compose_id = mail_compose.create(cr, uid, {'subject': 'Forget me subject', 'body': 'Dummy body'}, context)
compose = mail_compose.browse(cr, uid, compose_id, context)
onchange_res = compose.onchange_template_id(email_template_id, 'comment', 'mail.group', self.group_pigs_id)['value']
onchange_res['partner_ids'] = [(4, partner_id) for partner_id in onchange_res.pop('partner_ids', [])]
@@ -146,7 +146,7 @@ class test_message_compose(TestMail):
'default_partner_ids': [p_a_id],
'active_ids': [self.group_pigs_id, self.group_bird_id]
}
- compose_id = mail_compose.create(cr, uid, {'subject': 'Forget me subject', 'body': 'Dummy body', 'post': True}, context)
+ compose_id = mail_compose.create(cr, uid, {'subject': 'Forget me subject', 'body': 'Dummy body'}, context)
compose = mail_compose.browse(cr, uid, compose_id, context)
onchange_res = compose.onchange_template_id(email_template_id, 'mass_mail', 'mail.group', self.group_pigs_id)['value']
onchange_res['partner_ids'] = [(4, partner_id) for partner_id in onchange_res.pop('partner_ids', [])]
@@ -172,12 +172,12 @@ class test_message_compose(TestMail):
self.assertIn(_body_html1, message_pigs.body, 'mail.message body on Pigs incorrect')
self.assertIn(_body_html2, message_bird.body, 'mail.message body on Bird incorrect')
# Test: partner_ids: p_a_id (default) + 3 newly created partners
- message_pigs_pids = [partner.id for partner in message_pigs.notified_partner_ids]
- message_bird_pids = [partner.id for partner in message_bird.notified_partner_ids]
- partner_ids = self.res_partner.search(cr, uid, [('email', 'in', ['b@b.b', 'c@c.c', 'd@d.d'])])
- partner_ids.append(p_a_id)
- self.assertEqual(set(message_pigs_pids), set(partner_ids), 'mail.message on pigs incorrect number of notified_partner_ids')
- self.assertEqual(set(message_bird_pids), set(partner_ids), 'mail.message on bird notified_partner_ids incorrect')
+ # message_pigs_pids = [partner.id for partner in message_pigs.notified_partner_ids]
+ # message_bird_pids = [partner.id for partner in message_bird.notified_partner_ids]
+ # partner_ids = self.res_partner.search(cr, uid, [('email', 'in', ['b@b.b', 'c@c.c', 'd@d.d'])])
+ # partner_ids.append(p_a_id)
+ # self.assertEqual(set(message_pigs_pids), set(partner_ids), 'mail.message on pigs incorrect number of notified_partner_ids')
+ # self.assertEqual(set(message_bird_pids), set(partner_ids), 'mail.message on bird notified_partner_ids incorrect')
# ----------------------------------------
# CASE4: test newly introduced partner_to field
@@ -237,8 +237,8 @@ class test_message_compose(TestMail):
email_template.send_mail(cr, uid, email_template_id, self.group_pigs_id, force_send=True, context=context)
sent_emails = self._build_email_kwargs_list
email_to_lst = [
- ['b@b.b', 'c@c.c'], ['"Followers of Pigs" <admin@yourcompany.example.com>'],
- ['"Followers of Pigs" <raoul@raoul.fr>'], ['"Followers of Pigs" <bert@bert.fr>']]
+ ['b@b.b', 'c@c.c'], ['Administrator <admin@yourcompany.example.com>'],
+ ['Raoul Grosbedon <raoul@raoul.fr>'], ['Bert Tartignole <bert@bert.fr>']]
self.assertEqual(len(sent_emails), 4, 'email_template: send_mail: 3 valid email recipients + email_to -> should send 4 emails')
for email in sent_emails:
self.assertIn(email['email_to'], email_to_lst, 'email_template: send_mail: wrong email_recipients')
diff --git a/addons/email_template/wizard/email_template_preview.py b/addons/email_template/wizard/email_template_preview.py
index 5fee415a75e..104437ec0d3 100644
--- a/addons/email_template/wizard/email_template_preview.py
+++ b/addons/email_template/wizard/email_template_preview.py
@@ -66,6 +66,7 @@ class email_template_preview(osv.osv_memory):
_columns = {
'res_id': fields.selection(_get_records, 'Sample Document'),
+ 'partner_ids': fields.many2many('res.partner', string='Recipients'),
}
def on_change_res_id(self, cr, uid, ids, res_id, context=None):
@@ -80,7 +81,7 @@ class email_template_preview(osv.osv_memory):
# generate and get template values
mail_values = email_template.generate_email(cr, uid, template_id, res_id, context=context)
- vals = dict((field, mail_values.get(field, False)) for field in ('email_from', 'email_to', 'email_cc', 'reply_to', 'subject', 'body_html', 'partner_to'))
+ vals = dict((field, mail_values.get(field, False)) for field in ('email_from', 'email_to', 'email_cc', 'reply_to', 'subject', 'body_html', 'partner_to', 'partner_ids', 'attachment_ids'))
vals['name'] = template.name
return {'value': vals}
diff --git a/addons/email_template/wizard/email_template_preview_view.xml b/addons/email_template/wizard/email_template_preview_view.xml
index 0a74f7d813e..87c1e92fa60 100644
--- a/addons/email_template/wizard/email_template_preview_view.xml
+++ b/addons/email_template/wizard/email_template_preview_view.xml
@@ -8,14 +8,17 @@
<field name="arch" type="xml">
<form string="Email Preview" version="7.0">
<field name="model_id" invisible="1"/>
- <h2 style="color: #7c7bad;">Preview of <field name="name" readonly="1" nolabel="1" class="oe_inline"/></h2>
- Using sample document <field name="res_id" on_change="on_change_res_id(res_id, context)" class="oe_inline"/>
+ <h3>Preview of <field name="name" readonly="1" nolabel="1" class="oe_inline"/></h3>
+ Choose an example <field name="model_id" class="oe_inline" readonly="1"/> record:
+ <field name="res_id" on_change="on_change_res_id(res_id, context)" class="oe_inline"
+ style="margin-left: 8px;"/>
<group>
<field name="subject" readonly="1"/>
<field name="email_from" readonly="1"
attrs="{'invisible':[('email_from','=',False)]}"/>
- <field name="email_to" readonly="1"/>
- <field name="partner_to" readonly="1"/>
+ <field name="partner_ids" widget="many2many_tags" readonly="1"/>
+ <field name="email_to" readonly="1"
+ attrs="{'invisible':[('email_to','=',False)]}"/>
<field name="email_cc" readonly="1"
attrs="{'invisible':[('email_cc','=',False)]}"/>
<field name="reply_to" readonly="1"
@@ -23,6 +26,7 @@
</group>
<field name="body_html" widget="html" readonly="1"
nolabel="1" options='{"safe": True}'/>
+ <field name="attachment_ids" widget="many2many_binary" radonly="1"/>
</form>
</field>
</record>
@@ -30,10 +34,11 @@
<record id="wizard_email_template_preview" model="ir.actions.act_window">
<field name="name">Template Preview</field>
<field name="res_model">email_template.preview</field>
- <field name="src_model">email_template.preview</field>
+ <field name="src_model">email.template</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
+ <field name="view_id" ref="email_template_preview_form"/>
<field name="auto_refresh" eval="1" />
<field name="target">new</field>
<field name="context">{'template_id':active_id}</field>
diff --git a/addons/email_template/wizard/mail_compose_message.py b/addons/email_template/wizard/mail_compose_message.py
index 71f99471afa..676f11b23e3 100644
--- a/addons/email_template/wizard/mail_compose_message.py
+++ b/addons/email_template/wizard/mail_compose_message.py
@@ -42,7 +42,8 @@ class mail_compose_message(osv.TransientModel):
_inherit = 'mail.compose.message'
def default_get(self, cr, uid, fields, context=None):
- """ Override to pre-fill the data when having a template in single-email mode """
+ """ Override to pre-fill the data when having a template in single-email mode
+ and not going through the view: the on_change is not called in that case. """
if context is None:
context = {}
res = super(mail_compose_message, self).default_get(cr, uid, fields, context=context)
@@ -50,19 +51,13 @@ class mail_compose_message(osv.TransientModel):
res.update(
self.onchange_template_id(
cr, uid, [], context['default_template_id'], res.get('composition_mode'),
- res.get('model'), res.get('res_id', context.get('active_id')), context=context
+ res.get('model'), res.get('res_id'), context=context
)['value']
)
return res
_columns = {
'template_id': fields.many2one('email.template', 'Use template', select=True),
- 'partner_to': fields.char('To (Partner IDs)',
- help="Comma-separated list of recipient partners ids (placeholders may be used here)"),
- 'email_to': fields.char('To (Emails)',
- help="Comma-separated recipient addresses (placeholders may be used here)",),
- 'email_cc': fields.char('Cc (Emails)',
- help="Carbon copy recipients (placeholders may be used here)"),
}
def send_mail(self, cr, uid, ids, context=None):
@@ -92,14 +87,13 @@ class mail_compose_message(osv.TransientModel):
""" - mass_mailing: we cannot render, so return the template values
- normal mode: return rendered values """
if template_id and composition_mode == 'mass_mail':
- fields = ['subject', 'body_html', 'email_from', 'email_to', 'partner_to', 'email_cc', 'reply_to', 'attachment_ids', 'mail_server_id']
+ fields = ['subject', 'body_html', 'email_from', 'reply_to', 'attachment_ids', 'mail_server_id']
template_values = self.pool.get('email.template').read(cr, uid, template_id, fields, context)
values = dict((field, template_values[field]) for field in fields if template_values.get(field))
elif template_id:
values = self.generate_email_for_composer_batch(cr, uid, template_id, [res_id], context=context)[res_id]
# transform attachments into attachment_ids; not attached to the document because this will
# be done further in the posting process, allowing to clean database if email not send
- values['attachment_ids'] = values.pop('attachment_ids', [])
ir_attach_obj = self.pool.get('ir.attachment')
for attach_fname, attach_datas in values.pop('attachments', []):
data_attach = {
@@ -110,7 +104,7 @@ class mail_compose_message(osv.TransientModel):
'res_id': 0,
'type': 'binary', # override default_type from context, possibly meant for another model!
}
- values['attachment_ids'].append(ir_attach_obj.create(cr, uid, data_attach, context=context))
+ values.setdefault('attachment_ids', list()).append(ir_attach_obj.create(cr, uid, data_attach, context=context))
else:
values = self.default_get(cr, uid, ['subject', 'body', 'email_from', 'email_to', 'email_cc', 'partner_to', 'reply_to', 'attachment_ids', 'mail_server_id'], context=context)
@@ -148,47 +142,29 @@ class mail_compose_message(osv.TransientModel):
# Wizard validation and send
#------------------------------------------------------
- def _get_or_create_partners_from_values(self, cr, uid, rendered_values, context=None):
- """ Check for email_to, email_cc, partner_to """
- partner_ids = []
- mails = tools.email_split(rendered_values.pop('email_to', '')) + tools.email_split(rendered_values.pop('email_cc', ''))
- for mail in mails:
- partner_id = self.pool.get('res.partner').find_or_create(cr, uid, mail, context=context)
- partner_ids.append(partner_id)
- partner_to = rendered_values.pop('partner_to', '')
- if partner_to:
- # placeholders could generate '', 3, 2 due to some empty field values
- tpl_partner_ids = [pid for pid in partner_to.split(',') if pid]
- partner_ids += self.pool['res.partner'].exists(cr, SUPERUSER_ID, tpl_partner_ids, context=context)
- return partner_ids
-
def generate_email_for_composer_batch(self, cr, uid, template_id, res_ids, context=None, fields=None):
""" Call email_template.generate_email(), get fields relevant for
mail.compose.message, transform email_cc and email_to into partner_ids """
- # filter template values
+ if context is None:
+ context = {}
if fields is None:
fields = ['subject', 'body_html', 'email_from', 'email_to', 'partner_to', 'email_cc', 'reply_to', 'attachment_ids', 'mail_server_id']
- returned_fields = fields + ['attachments']
+ returned_fields = fields + ['partner_ids', 'attachments']
values = dict.fromkeys(res_ids, False)
- template_values = self.pool.get('email.template').generate_email_batch(cr, uid, template_id, res_ids, fields=fields, context=context)
+ ctx = dict(context, tpl_partners_only=True)
+ template_values = self.pool.get('email.template').generate_email_batch(cr, uid, template_id, res_ids, fields=fields, context=ctx)
for res_id in res_ids:
res_id_values = dict((field, template_values[res_id][field]) for field in returned_fields if template_values[res_id].get(field))
res_id_values['body'] = res_id_values.pop('body_html', '')
-
- # transform email_to, email_cc into partner_ids
- ctx = dict((k, v) for k, v in (context or {}).items() if not k.startswith('default_'))
- partner_ids = self._get_or_create_partners_from_values(cr, uid, res_id_values, context=ctx)
- # legacy template behavior: void values do not erase existing values and the
- # related key is removed from the values dict
- if partner_ids:
- res_id_values['partner_ids'] = list(partner_ids)
-
values[res_id] = res_id_values
return values
def render_message_batch(self, cr, uid, wizard, res_ids, context=None):
""" Override to handle templates. """
+ # generate composer values
+ composer_values = super(mail_compose_message, self).render_message_batch(cr, uid, wizard, res_ids, context)
+
# generate template-based values
if wizard.template_id:
template_values = self.generate_email_for_composer_batch(
@@ -196,17 +172,18 @@ class mail_compose_message(osv.TransientModel):
fields=['email_to', 'partner_to', 'email_cc', 'attachment_ids', 'mail_server_id'],
context=context)
else:
- template_values = dict.fromkeys(res_ids, dict())
- # generate composer values
- composer_values = super(mail_compose_message, self).render_message_batch(cr, uid, wizard, res_ids, context)
+ template_values = {}
for res_id in res_ids:
- # remove attachments from template values as they should not be rendered
- template_values[res_id].pop('attachment_ids', None)
- # remove some keys from composer that are readonly
- composer_values[res_id].pop('email_to', None)
- composer_values[res_id].pop('email_cc', None)
- composer_values[res_id].pop('partner_to', None)
+ if template_values.get(res_id):
+ # recipients are managed by the template
+ composer_values[res_id].pop('partner_ids')
+ composer_values[res_id].pop('email_to')
+ composer_values[res_id].pop('email_cc')
+ # remove attachments from template values as they should not be rendered
+ template_values[res_id].pop('attachment_ids', None)
+ else:
+ template_values[res_id] = dict()
# update template values by composer values
template_values[res_id].update(composer_values[res_id])
return template_values
diff --git a/addons/email_template/wizard/mail_compose_message_view.xml b/addons/email_template/wizard/mail_compose_message_view.xml
index 44145114fff..2f755a625d6 100644
--- a/addons/email_template/wizard/mail_compose_message_view.xml
+++ b/addons/email_template/wizard/mail_compose_message_view.xml
@@ -7,22 +7,6 @@
<field name="model">mail.compose.message</field>
<field name="inherit_id" ref="mail.email_compose_message_wizard_form"/>
<field name="arch" type="xml">
- <xpath expr="//field[@name='subject']" position="after">
- <label string="Template Recipients" for="partner_to"
- groups="base.group_no_one"
- attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>
- <div groups="base.group_no_one" name="template_recipients"
- attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}">
- <group class="oe_grey">
- <!-- <label string="Partners" for="partner_to"/> -->
- <field name="partner_to" readonly="1"/>
- <!-- <label string="Email To" for="email_to"/> -->
- <field name="email_to" readonly="1"/>
- <!-- <label string="Email CC" for="email_cc"/> -->
- <field name="email_cc" readonly="1"/>
- </group>
- </div>
- </xpath>
<xpath expr="//footer" position="inside">
<group class="oe_right oe_form" col="1">
<div>Use template