diff --git a/addons/account/controllers/portal.py b/addons/account/controllers/portal.py index 4a9ac95df3a..e86e9f52746 100644 --- a/addons/account/controllers/portal.py +++ b/addons/account/controllers/portal.py @@ -79,7 +79,23 @@ class PortalAccount(CustomerPortal): return request.render("account.portal_my_invoices", values) @http.route(['/my/invoices/'], type='http', auth="public", website=True) - def portal_my_invoices_report(self, invoice_id, access_token=None, **kw): + def portal_my_invoice_detail(self, invoice_id, access_token=None, **kw): + invoice = request.env['account.invoice'].browse(invoice_id) + try: + invoice.check_access_rights('read') + invoice.check_access_rule('read') + except AccessError: + if not access_token or not consteq(invoice.sudo().access_token, access_token): + return request.redirect('/my') + + values = { + 'page_name': 'invoice', + 'invoice': invoice.sudo(), + } + return request.render("account.portal_invoice_page", values) + + @http.route(['/my/invoices/pdf/'], type='http', auth="public", website=True) + def portal_my_invoice_report(self, invoice_id, access_token=None, **kw): invoice = request.env['account.invoice'].browse(invoice_id) try: invoice.check_access_rights('read') diff --git a/addons/account/data/mail_template_data.xml b/addons/account/data/mail_template_data.xml index 266ac35855b..949895e3c1c 100644 --- a/addons/account/data/mail_template_data.xml +++ b/addons/account/data/mail_template_data.xml @@ -20,7 +20,7 @@

Dear ${object.partner_id.name} % set access_action = object.with_context(force_website=True).get_access_action() % set is_online = access_action and access_action['type'] == 'ir.actions.act_url' -% set access_url = is_online and object.get_mail_url() or '/report/pdf/account.report_invoice/' + str(object.id) +% set access_url = object.get_mail_url() % if object.partner_id.parent_id: (${object.partner_id.parent_id.name}) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 5ff980cf4b0..de297e73aa5 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -748,11 +748,19 @@ class AccountInvoice(models.Model): try: record.check_access_rule('read') except exceptions.AccessError: - pass + if self.env.context.get('force_website'): + return { + 'type': 'ir.actions.act_url', + 'url': '/my/invoices/%s' % self.id, + 'target': 'self', + 'res_id': self.id, + } + else: + pass else: return { 'type': 'ir.actions.act_url', - 'url': '/my/invoices?', # No controller /my/invoices/, only a report pdf + 'url': '/my/invoices/%s?access_token=%s' % (self.id, self.access_token), 'target': 'self', 'res_id': self.id, } @@ -1394,6 +1402,7 @@ class AccountInvoiceLine(models.Model): ondelete='set null', index=True, oldname='uos_id') product_id = fields.Many2one('product.product', string='Product', ondelete='restrict', index=True) + product_image = fields.Binary('Product Image', related="product_id.image", store=False) account_id = fields.Many2one('account.account', string='Account', required=True, domain=[('deprecated', '=', False)], default=_default_account, diff --git a/addons/account/views/account_portal_templates.xml b/addons/account/views/account_portal_templates.xml index cba163a8cb1..b724c466d13 100644 --- a/addons/account/views/account_portal_templates.xml +++ b/addons/account/views/account_portal_templates.xml @@ -4,6 +4,9 @@

  • Invoices
  • +
  • + +
  • @@ -38,7 +41,7 @@ - + @@ -63,4 +66,199 @@ - + + + + + \ No newline at end of file diff --git a/addons/account_payment/views/account_portal_templates.xml b/addons/account_payment/views/account_portal_templates.xml index 6d1c446e0f3..12dc68013af 100644 --- a/addons/account_payment/views/account_portal_templates.xml +++ b/addons/account_payment/views/account_portal_templates.xml @@ -1,7 +1,7 @@