diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index eb7d9926bbf..f7e561c8e24 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -672,25 +672,14 @@ class account_invoice(osv.osv): self.create_workflow(cr, uid, ids) return True - # ---------------------------------------- - # Mail related methods - # ---------------------------------------- - - def _get_formview_action(self, cr, uid, id, context=None): + def get_formview_id(self, cr, uid, id, context=None): """ Update form view id of action to open the invoice """ - action = super(account_invoice, self)._get_formview_action(cr, uid, id, context=context) obj = self.browse(cr, uid, id, context=context) if obj.type == 'in_invoice': model, view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_supplier_form') - action.update({ - 'views': [(view_id, 'form')], - }) else: model, view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_form') - action.update({ - 'views': [(view_id, 'form')], - }) - return action + return view_id # Workflow stuff ################# diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 1f24c371acd..210b8c94225 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -972,15 +972,13 @@ class crm_lead(format_address, osv.osv): return [lead.section_id.message_get_reply_to()[0] if lead.section_id else False for lead in self.browse(cr, SUPERUSER_ID, ids, context=context)] - def _get_formview_action(self, cr, uid, id, context=None): - action = super(crm_lead, self)._get_formview_action(cr, uid, id, context=context) + def get_formview_id(self, cr, uid, id, context=None): obj = self.browse(cr, uid, id, context=context) if obj.type == 'opportunity': model, view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'crm', 'crm_case_form_view_oppor') - action.update({ - 'views': [(view_id, 'form')], - }) - return action + else: + view_id = super(crm_lead, self).get_formview_id(cr, uid, id, model=model, context=context) + return view_id def message_get_suggested_recipients(self, cr, uid, ids, context=None): recipients = super(crm_lead, self).message_get_suggested_recipients(cr, uid, ids, context=context) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 1d7e6730427..112dff6bac6 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -588,23 +588,6 @@ class mail_thread(osv.AbstractModel): model_obj.check_access_rights(cr, uid, check_operation) model_obj.check_access_rule(cr, uid, mids, check_operation, context=context) - def _get_formview_action(self, cr, uid, id, model=None, 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 - :param string model: specific model that overrides self._name - """ - return { - 'type': 'ir.actions.act_window', - 'res_model': model or self._name, - 'view_type': 'form', - 'view_mode': 'form', - 'views': [(False, 'form')], - 'target': 'current', - 'res_id': id, - } - def _get_inbox_action_xml_id(self, cr, uid, context=None): """ When redirecting towards the Inbox, choose which action xml_id has to be fetched. This method is meant to be inherited, at least in portal @@ -647,10 +630,7 @@ class mail_thread(osv.AbstractModel): if model_obj.check_access_rights(cr, uid, 'read', raise_exception=False): try: model_obj.check_access_rule(cr, uid, [res_id], 'read', context=context) - if not hasattr(model_obj, '_get_formview_action'): - action = self.pool.get('mail.thread')._get_formview_action(cr, uid, res_id, model=model, context=context) - else: - action = model_obj._get_formview_action(cr, uid, res_id, context=context) + action = model_obj.get_formview_action(cr, uid, res_id, context=context) except (osv.except_osv, orm.except_orm): pass action.update({