OSV Method Return Statement

In OpenERP, an OSV object can return something that can open a new view or activate an action. For example, sale.order has a manual_invoice method that returns the following:

  return { 'name': _('Customer Invoices'), 'view_type': 'form', 'view_mode': 'form', 'view_id': [res_id], 'res_model': 'account.invoice', 'context': "{'type':'out_invoice'}", 'type': 'ir.actions.act_window', 'nodestroy': True, 'target': 'current', 'res_id': inv_ids and inv_ids[0] or False, } 

and opens the invoice form window in the same window.

I saw that 'view_id': [res_id], changed to 'views': [(id2, 'form')], , and the other parts are also changed, and it still works.

So I don’t understand how this mechanism works. What determines which values ​​in the return dict should be included? How can I find out which of them are mandatory and which are not?

Many thanks!

+4
source share
1 answer

The returned dictionary is interpreted as an action ( ir.actions.act_window model), such as those contained in XML views. Documentation is available in the Technical Notice and in white papers .

+5
source

All Articles