From 4b6218874a176ea244d4f2f7cd038cf110b600fb Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 30 Mar 2016 13:22:01 +0200 Subject: [PATCH] [FIX] account: re-introduce get_formview_id for invoices `get_formview_id` returns a view id to open the document with. This method is meant to be overridden in addons that want to give specific view ids for example. A link to an invoice must open a different form view according if this is a customer or a vendor invoice. This is handled by overriding `get_formview_id` and returning the view id that should be used according to something in the record (e.g. according to the `type` field). It was present in 8.0, it was somehow removed in Odoo 9.0 during the refactoring of the accounting modules, probably for a wrong reason. opw-673246 --- addons/account/models/account_invoice.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index aedb6e9f133..787fc536d45 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -497,6 +497,14 @@ class AccountInvoice(models.Model): self.create_workflow() return True + @api.multi + def get_formview_id(self): + """ Update form view id of action to open the invoice """ + if self.type == 'in_invoice': + return self.env.ref('account.invoice_supplier_form').id + else: + return self.env.ref('account.invoice_form').id + @api.multi def get_taxes_values(self): tax_grouped = {}