[ADD] osv: add get_formview_action and get_formview_id methods

return an action to open the document. This method is meant to be
overridden in addons that want to give specific view ids for example

bzr revid: dle@openerp.com-20140416143431-syqu1ko74xt04oo5
This commit is contained in:
Denis Ledoux 2014-04-16 16:34:31 +02:00
parent 146326e039
commit 42025a6af5
1 changed files with 25 additions and 0 deletions

View File

@ -1915,6 +1915,31 @@ class BaseModel(object):
}
return result
def get_formview_id(self, cr, uid, id, context=None):
""" Return an 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.
:param int id: id of the document to open
"""
return False
def get_formview_action(self, cr, uid, id, context=None):
""" Return an action to open the document. This method is meant to be
overridden in addons that want to give specific view ids for example.
:param int id: id of the document to open
"""
view_id = self.get_formview_id(cr, uid, id, context=context)
return {
'type': 'ir.actions.act_window',
'res_model': self._name,
'view_type': 'form',
'view_mode': 'form',
'views': [(view_id, 'form')],
'target': 'current',
'res_id': id,
}
def _view_look_dom_arch(self, cr, uid, node, view_id, context=None):
return self.pool['ir.ui.view'].postprocess_and_fields(
cr, uid, self._name, node, view_id, context=context)