self.create_workflow(cr, uid, ids)
return True
+ # ----------------------------------------
+ # Mail related methods
+ # ----------------------------------------
+
+ def _get_formview_action(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
+
# Workflow stuff
#################
return [lead.section_id.message_get_reply_to()[0] if lead.section_id else False
for lead in self.browse(cr, uid, ids, context=context)]
- def _get_document_action(self, cr, uid, id, context=None):
- action = super(crm_lead, self)._get_document_action(cr, uid, id, 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)
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')
ir_attachment_obj.unlink(cr, uid, attach_ids, context=context)
return True
- def _get_document_action(self, cr, uid, id, model=None, context=None):
+ 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.
try:
model_obj = self.pool.get(msg.model)
model_obj.check_access_rule(cr, uid, [msg.res_id], 'read', context=context)
- if not hasattr(model_obj, '_get_document_action'):
- action = self.pool.get('mail.thread')._get_document_action(cr, uid, msg.res_id, model=msg.model, context=context)
+ if not hasattr(model_obj, '_get_formview_action'):
+ action = self.pool.get('mail.thread')._get_formview_action(cr, uid, msg.res_id, model=msg.model, context=context)
else:
- action = model_obj._get_document_action(cr, uid, msg.res_id, context=context)
+ action = model_obj._get_formview_action(cr, uid, msg.res_id, context=context)
except (osv.except_osv, orm.except_orm):
action.update({
'context': {