prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Unable to send email on new template
  module: mail_notification_email_template
  version: 8.0
  
  **Steps to reproduce**
  - Install Sales module and activate technical settings
    -configure and test one outgoing server
  - Create a new template for Quotation sent ( can keep most values the same as per the Discussions example) , although my final goal is to utilize fields from the sales Quotation
  - Create a new draft quotation , add new followers (internal users and one customer)
  - make sure that followers is part of the Quotation sent sub type (eg they will receive emails)
  - Print the quotation
  
  **Current behavior**
  - Emails fails most of the time to all followers, although i have had cases where it succeeds in sending to one.
    -remainder of emails is stuck showing failed status.
    Log file shows :
    **odoo attributeerror: 'mail.notification' object has no attribute '_get_access_link'**
  
  **Expected behavior**
  -All emails are supposed to go out using the configured template.
  
  (i have had success where i manually configure the to Email field with email addresses, thus the issue is possibly with the formatting of the to(partners) field, which is currently
  ${object.partner_id.ids|join(',')}
  
  I currently don't have access to my server logs, but will attach clean logs asap. 
  Is there any verbose mode i might need to activate?  (there is debugging on the outgoing servers, but it doesn't seem to generate more data)
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `mail_notification_email_template/models/mail_notification.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 # © 2016 Therp BV <http://therp.nl>
  3 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4 from lxml import etree
  5 from openerp import api, fields, models
  6 
  7 
  8 class MailNotification(models.Model):
  9     _inherit = 'mail.notification'
  10 
  11     record = fields.Reference(
  12         selection=lambda self: [
  13             (m.model, m.name) for m in self.env['ir.model'].search([])
  14         ],
  15         compute='_compute_record')
  16     record_access_link = fields.Char(compute='_compute_record')
  17 
  18     @api.multi
  19     def _notify_email(self, message_id, force_send=False, user_signature=True):
  20         if not self.mapped('message_id.subtype_id.template_id'):
  21             return super(MailNotification, self)._notify_email(
  22                 message_id, force_send=force_send,
  23                 user_signature=user_signature)
  24         message_ids = []
  25         for this in self:
  26             if not this.mapped('message_id.subtype_id.template_id'):
  27                 super(MailNotification, this)._notify_email(
  28                     message_id, force_send=force_send,
  29                     user_signature=user_signature)
  30                 continue
  31             message = this.message_id
  32             if not this.get_partners_to_email(message):
  33                 continue
  34             custom_values = {
  35                 'references': message.parent_id.message_id,
  36             }
  37             if message.res_id and hasattr(
  38                 self.env[message.model], 'message_get_email_values'
  39             ):
  40                 message_values = self.env[message.model].browse(
  41                     message.res_id
  42                 ).message_get_email_values(message)
  43                 # message_get_email_values is guessed to @api.one
  44                 if message_values and isinstance(message_values, list):
  45                     message_values = message_values[0]
  46                 custom_values.update(message_values)
  47             message_id = message.subtype_id.template_id.send_mail(this.id)
  48             if 'mail_message_id' in custom_values:
  49                 custom_values.pop('mail_message_id')
  50             self.env['mail.mail'].browse(message_id).write(custom_values)
  51             message_ids.append(message_id)
  52         return message_ids or True
  53 
  54     @api.multi
  55     def _compute_record(self):
  56         for this in self:
  57             if not this.message_id.model or not this.message_id.res_id:
  58                 continue
  59             this.record = self.env[this.message_id.model].browse(
  60                 this.message_id.res_id)
  61             link_html = self.env['mail.mail']._get_partner_access_link(
  62                 self.env['mail.mail'].new({
  63                     'notification': True,
  64                     'mail_message_id': this.message_id.id,
  65                 }),
  66                 this.partner_id
  67             )
  68             for a in etree.HTML(link_html).xpath('//a[@href]'):
  69                 this.record_access_link = a.get('href')
  70
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/mail_notification_email_template/models/mail_notification.py b/mail_notification_email_template/models/mail_notification.py
  --- a/mail_notification_email_template/models/mail_notification.py
  +++ b/mail_notification_email_template/models/mail_notification.py
  @@ -65,5 +65,5 @@
                   }),
                   this.partner_id
               )
  -            for a in etree.HTML(link_html).xpath('//a[@href]'):
  +            for a in etree.HTML(link_html or '<html/>').xpath('//a[@href]'):
                   this.record_access_link = a.get('href')
  
verification_info: {"golden_diff": "diff --git a/mail_notification_email_template/models/mail_notification.py b/mail_notification_email_template/models/mail_notification.py\n--- a/mail_notification_email_template/models/mail_notification.py\n+++ b/mail_notification_email_template/models/mail_notification.py\n@@ -65,5 +65,5 @@\n                 }),\n                 this.partner_id\n             )\n-            for a in etree.HTML(link_html).xpath('//a[@href]'):\n+            for a in etree.HTML(link_html or '<html/>').xpath('//a[@href]'):\n                 this.record_access_link = a.get('href')\n", "issue": "Unable to send email on new template\nmodule: mail_notification_email_template\nversion: 8.0\n\n**Steps to reproduce**\n- Install Sales module and activate technical settings\n  -configure and test one outgoing server\n- Create a new template for Quotation sent ( can keep most values the same as per the Discussions example) , although my final goal is to utilize fields from the sales Quotation\n- Create a new draft quotation , add new followers (internal users and one customer)\n- make sure that followers is part of the Quotation sent sub type (eg they will receive emails)\n- Print the quotation\n\n**Current behavior**\n- Emails fails most of the time to all followers, although i have had cases where it succeeds in sending to one.\n  -remainder of emails is stuck showing failed status.\n  Log file shows :\n  **odoo attributeerror: 'mail.notification' object has no attribute '_get_access_link'**\n\n**Expected behavior**\n-All emails are supposed to go out using the configured template.\n\n(i have had success where i manually configure the to Email field with email addresses, thus the issue is possibly with the formatting of the to(partners) field, which is currently\n${object.partner_id.ids|join(',')}\n\nI currently don't have access to my server logs, but will attach clean logs asap. \nIs there any verbose mode i might need to activate?  (there is debugging on the outgoing servers, but it doesn't seem to generate more data)\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# \u00a9 2016 Therp BV <http://therp.nl>\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\nfrom lxml import etree\nfrom openerp import api, fields, models\n\n\nclass MailNotification(models.Model):\n    _inherit = 'mail.notification'\n\n    record = fields.Reference(\n        selection=lambda self: [\n            (m.model, m.name) for m in self.env['ir.model'].search([])\n        ],\n        compute='_compute_record')\n    record_access_link = fields.Char(compute='_compute_record')\n\n    @api.multi\n    def _notify_email(self, message_id, force_send=False, user_signature=True):\n        if not self.mapped('message_id.subtype_id.template_id'):\n            return super(MailNotification, self)._notify_email(\n                message_id, force_send=force_send,\n                user_signature=user_signature)\n        message_ids = []\n        for this in self:\n            if not this.mapped('message_id.subtype_id.template_id'):\n                super(MailNotification, this)._notify_email(\n                    message_id, force_send=force_send,\n                    user_signature=user_signature)\n                continue\n            message = this.message_id\n            if not this.get_partners_to_email(message):\n                continue\n            custom_values = {\n                'references': message.parent_id.message_id,\n            }\n            if message.res_id and hasattr(\n                self.env[message.model], 'message_get_email_values'\n            ):\n                message_values = self.env[message.model].browse(\n                    message.res_id\n                ).message_get_email_values(message)\n                # message_get_email_values is guessed to @api.one\n                if message_values and isinstance(message_values, list):\n                    message_values = message_values[0]\n                custom_values.update(message_values)\n            message_id = message.subtype_id.template_id.send_mail(this.id)\n            if 'mail_message_id' in custom_values:\n                custom_values.pop('mail_message_id')\n            self.env['mail.mail'].browse(message_id).write(custom_values)\n            message_ids.append(message_id)\n        return message_ids or True\n\n    @api.multi\n    def _compute_record(self):\n        for this in self:\n            if not this.message_id.model or not this.message_id.res_id:\n                continue\n            this.record = self.env[this.message_id.model].browse(\n                this.message_id.res_id)\n            link_html = self.env['mail.mail']._get_partner_access_link(\n                self.env['mail.mail'].new({\n                    'notification': True,\n                    'mail_message_id': this.message_id.id,\n                }),\n                this.partner_id\n            )\n            for a in etree.HTML(link_html).xpath('//a[@href]'):\n                this.record_access_link = a.get('href')\n", "path": "mail_notification_email_template/models/mail_notification.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n# \u00a9 2016 Therp BV <http://therp.nl>\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\nfrom lxml import etree\nfrom openerp import api, fields, models\n\n\nclass MailNotification(models.Model):\n    _inherit = 'mail.notification'\n\n    record = fields.Reference(\n        selection=lambda self: [\n            (m.model, m.name) for m in self.env['ir.model'].search([])\n        ],\n        compute='_compute_record')\n    record_access_link = fields.Char(compute='_compute_record')\n\n    @api.multi\n    def _notify_email(self, message_id, force_send=False, user_signature=True):\n        if not self.mapped('message_id.subtype_id.template_id'):\n            return super(MailNotification, self)._notify_email(\n                message_id, force_send=force_send,\n                user_signature=user_signature)\n        message_ids = []\n        for this in self:\n            if not this.mapped('message_id.subtype_id.template_id'):\n                super(MailNotification, this)._notify_email(\n                    message_id, force_send=force_send,\n                    user_signature=user_signature)\n                continue\n            message = this.message_id\n            if not this.get_partners_to_email(message):\n                continue\n            custom_values = {\n                'references': message.parent_id.message_id,\n            }\n            if message.res_id and hasattr(\n                self.env[message.model], 'message_get_email_values'\n            ):\n                message_values = self.env[message.model].browse(\n                    message.res_id\n                ).message_get_email_values(message)\n                # message_get_email_values is guessed to @api.one\n                if message_values and isinstance(message_values, list):\n                    message_values = message_values[0]\n                custom_values.update(message_values)\n            message_id = message.subtype_id.template_id.send_mail(this.id)\n            if 'mail_message_id' in custom_values:\n                custom_values.pop('mail_message_id')\n            self.env['mail.mail'].browse(message_id).write(custom_values)\n            message_ids.append(message_id)\n        return message_ids or True\n\n    @api.multi\n    def _compute_record(self):\n        for this in self:\n            if not this.message_id.model or not this.message_id.res_id:\n                continue\n            this.record = self.env[this.message_id.model].browse(\n                this.message_id.res_id)\n            link_html = self.env['mail.mail']._get_partner_access_link(\n                self.env['mail.mail'].new({\n                    'notification': True,\n                    'mail_message_id': this.message_id.id,\n                }),\n                this.partner_id\n            )\n            for a in etree.HTML(link_html or '<html/>').xpath('//a[@href]'):\n                this.record_access_link = a.get('href')\n", "path": "mail_notification_email_template/models/mail_notification.py"}]}