From abcdcb1748e824fc7108d1487fe49e70ab517b31 Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Mon, 26 Mar 2018 12:36:42 +0200 Subject: [PATCH] [IMP]GOLEM Resource Account : add header button to go to invoice directly --- .../models/golem_resource_reservation.py | 12 ++++++++++++ .../views/golem_resource_reservation_views.xml | 2 ++ 2 files changed, 14 insertions(+) diff --git a/golem_resource_account/models/golem_resource_reservation.py b/golem_resource_account/models/golem_resource_reservation.py index e5209db..dba0767 100644 --- a/golem_resource_account/models/golem_resource_reservation.py +++ b/golem_resource_account/models/golem_resource_reservation.py @@ -77,3 +77,15 @@ class GolemResourceReservation(models.Model): })] }) reservation.invoice_line_id = reservation.invoice_id.invoice_line_ids[0] + + @api.multi + def show_invoice(self): + """ Redirects to linked invoice """ + self.ensure_one() + reservation = self[0] + if reservation.invoice_id: + return {'type': 'ir.actions.act_window', + 'res_model': 'account.invoice', + 'res_id': reservation.invoice_id.id, + 'view_mode': 'form', + 'view_id': self.env.ref('account.invoice_form').id} diff --git a/golem_resource_account/views/golem_resource_reservation_views.xml b/golem_resource_account/views/golem_resource_reservation_views.xml index f25975b..a59e5ab 100644 --- a/golem_resource_account/views/golem_resource_reservation_views.xml +++ b/golem_resource_account/views/golem_resource_reservation_views.xml @@ -44,6 +44,8 @@ along with this program. If not, see .