odoo10 in the e-mail alert

odoo10 in the e-mail alert configuration is as follows:

1. Configure the mail server to

  Open developer mode, Settings -> Technology -> email -> to the mail server

  Set as follows:

  

  If the configuration is successful, click on the 'Test Connection', pop-up box will appear as follows:

  

2. Set the company mailbox for just configured e-mail address

  Settings -> Users -> Company, amend the company e-mail address

 

3. used in the model

 1 from odoo import models, fields, api, tools
 2 
 3 
 4 class InvoiceBill(models.Model):
 5     """
 6 
 7     """
 8     _name = 'esw.invoice.bill'
 9     _inherit = ['mail.alias.mixin', 'mail.thread', 'ir.needaction_mixin']
10     _description = u'邮件学习测试'
11     _order = 'create_date desc'
12 
13     def _get_domain_of_invoice_manager(self):
14         manager = self.env['ir.model.data'].xmlid_to_object('mail_test.esw_invoice_bill_manager_group')[0]
15         return [('id', 'in', manager.users.ids)]
16 
17     name = fields.Char(u'单据说明')
18     invoice_manager = fields.Many2one('res.users', u'仓库主管', domain=_get_domain_of_invoice_manager)
19     remark = fields.Text(u'备注')
20     alias_id = fields.Many2one('mail.alias', string='别名', ondelete="restrict", required=True)
21 
22     state = fields.Selection(
23         [
24             ('init', u'初始化'),
25             ('revert', u'Withdrawal ' ),
 26 is              ( ' Submit ' , U ' submitted ' ),
 27              ( ' delivered ' , U ' shipped ' ),
 28              ( ' Completed ' , U ' completed ' ),
 29          ],
 30          default = ' the init ' ,
 31 is          track_visibility = ' onChange ' ,
32         required=True,
 33 is      )
 34 is  
35      @ api.multi
 36      DEF _track_template (Self, Tracking):
 37 [          "" " 
38 is          provided: not configure domain alias [mail.catchall.domain]
 39          The parameter here [no_auto_thread] set to True, Mail can replay_to parameter is the expected value, otherwise it will be configured in the template xx.xx} {$
 40          which can send alert messages to normal, and send the message sender / recipient / REPLY_TO achieve the desired value;
 41          recipient can also reply to the charges, will appear as a message, that is mail.message, and do not associate with the original message
 42  
43          If you set a domain alias [mail.catchall.domain]
 44          Although parameter [no_auto_thread ] is not set, the message will replay_to parameter is the expected value, but failed to send the message, that comes away odoo email_from rules (odoo10 see Line-248 mail_mail.py),
 45          as follows:
 46             bounce_alias = self.env['ir.config_parameter'].get_param("mail.bounce.alias")
47                 catchall_domain = self.env['ir.config_parameter'].get_param("mail.catchall.domain")
48                 if bounce_alias and catchall_domain:
49                     if mail.model and mail.res_id:
50                         headers['Return-Path'] = '%s+%d-%s-%d@%s' % (bounce_alias, mail.id, mail.model, mail.res_id, catchall_domain)
51                     else:
52                         headers['Return-Path'] = '%s+%d@%s' % (bounce_alias, mail.id, catchall_domain)
53         对于设置了域别名[mail.catchall.case domain] has been no attempt is successful
54         :param tracking:
55         :return:
56         """
57         res = super(InvoiceBill, self)._track_template(tracking)
58 
59         template = self.env.ref('mail_test.esw_mail_test_template')
60 
61         res['template_id'] = (template, {
62             'composition_mode': 'mass_mail',
63             'no_auto_thread': True,
64         })
65         return res

 

Description:

  For incoming mail, the configuration is too much trouble, and now the whole process did not go through, not to say, if only for e-mail alert if the above is not a problem.

  About incoming mail:

  1. The need to configure the recipient mail server;

  2. The required configuration parameters, settings -> Technology -> Parameters -> system parameters are set as follows:

  

  mail.bounce.alias is in front of you send mail @ string, mail.catchall.alias alias is received, without receiving no need to configure;

  There is a system to collect items to be configured [domain alias] - mail.catchall.domain

  3. If you need to associate with mail.message, it seems also need to configure an alias (mail sent to me now is, when the other person replies, the system is not linked up, not in the form of a message, but the message)

  

  After receiving the message, provided -> Technology -> In Email -> message can be viewed,

  

  4. receive e-mail address alias provided -> Technology -> In Email -> alias, message_new method mail.thread then need to rewrite the model

 

  Designed to model, under the mail module mail.thread, mail.mail, mail.message, the mail server model base / ir / ir_mail_server.py

 

Guess you like

Origin www.cnblogs.com/edi-kai/p/11118448.html