hunk.code_window:     @api.multi
       def get_access_action(self):
           """ Instead of the classic form view, redirect to the online invoice for portal users. """
           self.ensure_one()
           if self.env.user.share:
               try:
                   self.check_access_rule('read')
               except exceptions.AccessError:
                   pass
               else:
  
hunk.labels: keep keep keep keep keep replace keep keep keep keep keep
hunk.after_edit:         if self.env.user.share or self.env.context.get('force_website'):
  
hunk.file_path: addons/website_portal_sale/models/account_invoice.py
hunk.type: replace
file: <?xml version="1.0" encoding="utf-8"?>
  <odoo>
      <data noupdate="1">
          <record id="account.email_template_edi_invoice" model="mail.template">
              <field name="body_html"><![CDATA[
  <p>Dear ${object.partner_id.name}
  % set access_action = object.get_access_action()
  % set access_url = access_action['type'] == 'ir.actions.act_url' and access_action['url'] or '/report/pdf/account.report_invoice/' + str(object.id)
  % set is_online = access_action and access_action['type'] == 'ir.actions.act_url'
  
  % if object.partner_id.parent_id:
      (<i>${object.partner_id.parent_id.name}</i>)
  % endif
  ,</p>
  <p>Here is your 
  % if object.number:
  invoice <strong>${object.number}</strong>
  % else:
  pro-forma invoice
  % endif
  % if object.origin:
  (with reference: ${object.origin} )
  % endif
  amounting in <strong>${object.amount_total} ${object.currency_id.name}</strong>
  from ${object.company_id.name}.
  </p>
  
  % if is_online:
      <br/><br/>
      <center>
        <a href="${access_url}" style="background-color: #1abc9c; padding: 20px; text-decoration: none; color: #fff; border-radius: 5px; font-size: 16px;" class="o_default_snippet_text">View Invoice</a>
      </center>
  % endif
      <br/><br/>
  
  % if object.reference_type=='bba' and object.reference:
      <p>Please use the following communication for your payment : <b>${object.reference}</b></p>
  % endif
  
  <p>Please remit payment at your earliest convenience.</p>
  <p>Thank you,</p>
  % if object.user_id and object.user_id.signature:
      ${object.user_id.signature | safe}
  % endif
  ]]></field>
          </record>
      </data>
  </odoo>
  