Browse Source

mail_fix_553: add name in from alias email

pull/18/head
Denis Baranov 9 years ago
parent
commit
fdebb2b740
  1. 1
      mail_fix_553/README.rst
  2. 5
      mail_fix_553/data.xml
  3. 3
      mail_fix_553/mail_fix_553.py

1
mail_fix_553/README.rst

@ -18,6 +18,7 @@ Configuration
=============
You can configure default alias at Settings -> System Parameters -> mail.catchall.alias_from
You can configure name for default alias at Settings -> System Parameters -> mail.catchall.name_alias_from
Known issues / Roadmap
======================

5
mail_fix_553/data.xml

@ -6,5 +6,10 @@
<field name="key">mail.catchall.alias_from</field>
<field name="value">portal</field>
</record>
<!-- Name for Catchall Email Alias -->
<record id="icp_mail_catchall_name_alias_from" model="ir.config_parameter">
<field name="key">mail.catchall.name_alias_from</field>
<field name="value">Odoo</field>
</record>
</data>
</openerp>

3
mail_fix_553/mail_fix_553.py

@ -38,6 +38,7 @@ class mail_mail(osv.Model):
# NEW STUFF
catchall_alias = self.pool['ir.config_parameter'].get_param(cr, uid, "mail.catchall.alias_from", context=context)
catchall_alias_name = self.pool['ir.config_parameter'].get_param(cr, uid, "mail.catchall.name_alias_from", context=context)
catchall_domain = self.pool['ir.config_parameter'].get_param(cr, uid, "mail.catchall.domain", context=context)
correct_email_from = '@%s>?\s*$'%catchall_domain
@ -101,6 +102,8 @@ class mail_mail(osv.Model):
email_from = mail.email_from
if re.search(correct_email_from, email_from) is None:
email_from = default_email_from
if catchall_alias_name:
email_from = formataddr((catchall_alias_name, email_from))
msg = ir_mail_server.build_email(
email_from=email_from, # NEW STUFF

Loading…
Cancel
Save