[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
This commit is contained in:
Denis Ledoux
2016-03-30 13:26:19 +02:00
parent 1b5c2ced45
commit 4b6218874a
+8
View File
@@ -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 = {}