diff options
| author | Yannick Tivisse <yti@odoo.com> | 2018-08-24 11:05:22 +0200 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2018-08-24 11:58:26 +0200 |
| commit | 89130b51b495b1a5a660b547b479ae88835af5d0 (patch) | |
| tree | 1b11c599c3c9306876be3bde813e6f57fb0dcca1 /addons/web/static/src/js/fields/basic_fields.js | |
| parent | 21ab939b4ca57b7dd3c0f40f2252f4b3d00ec62c (diff) | |
[FIX] base: Set a default email address for admin
Purpose
=======
Currently, as the admin as no email address, it's now impossible to install
the mail module without demo data, because of the following data:
<record model="mail.message" id="module_install_notification" context="{'mail_notify_noemail': True}">
<field name="model">mail.channel</field>
<field name="res_id" ref="mail.channel_all_employees"/>
<field name="message_type">email</field>
<field name="subtype_id" ref="mail.mt_comment"/>
<field name="subject">Welcome to Odoo!</field>
<field name="body"><![CDATA[<p>Welcome to the #general channel.</p>
<p>This channel is accessible to all users to <b>easily share company information</b>.</p>]]></field>
</record>
Because when creating a mail.message a user error is raised if no email address is found.
@api.model
def _get_default_from(self):
if self.env.user.email:
return formataddr((self.env.user.name, self.env.user.email))
raise UserError(_("Unable to post message, please configure the sender's email address."))
In a general way, all the users should have an email address.
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
0 files changed, 0 insertions, 0 deletions
