diff --git a/addons/mail_gateway/__init__.py b/addons/mail_gateway/__init__.py index 100cb5023b7..6526541a068 100644 --- a/addons/mail_gateway/__init__.py +++ b/addons/mail_gateway/__init__.py @@ -21,7 +21,6 @@ import mail_gateway import res_partner -import wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mail_gateway/__openerp__.py b/addons/mail_gateway/__openerp__.py index 62b02aa52c6..f442124193a 100644 --- a/addons/mail_gateway/__openerp__.py +++ b/addons/mail_gateway/__openerp__.py @@ -31,7 +31,6 @@ 'depends': ['base'], 'init_xml': [], 'update_xml': [ - 'wizard/mail_gateway_document_view.xml', "mail_gateway_view.xml", "res_partner_view.xml", 'security/ir.model.access.csv' diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py index d6de4b8ade8..9900540acae 100644 --- a/addons/mail_gateway/mail_gateway.py +++ b/addons/mail_gateway/mail_gateway.py @@ -179,6 +179,50 @@ class mailgate_message(osv.osv): ''' Mailgateway Message ''' + def open_document(self, cr, uid, ids, context): + """ To Open Document + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param ids: the ID of messages + @param context: A standard dictionary + """ + action_data = False + if ids: + message_id = ids[0] + mailgate_data = self.browse(cr, uid, message_id) + model = mailgate_data.model + res_id = mailgate_data.res_id + + action_pool = self.pool.get('ir.actions.act_window') + action_ids = action_pool.search(cr, uid, [('res_model', '=', model)]) + if action_ids: + action_data = action_pool.read(cr, uid, action_ids[0], context=context) + action_data.update({ + 'res_id': res_id, + 'nodestroy': True + }) + return action_data + + def open_attachment(self, cr, uid, ids, context): + """ To Open attachments + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param ids: the ID of messages + @param context: A standard dictionary + """ + action_data = False + action_pool = self.pool.get('ir.actions.act_window') + action_ids = action_pool.search(cr, uid, [('res_model', '=', 'ir.attachment')]) + if action_ids: + action_data = action_pool.read(cr, uid, action_ids[0], context=context) + action_data.update({ + 'domain': [('res_id','in',ids),('res_model','=',self._name)], + 'nodestroy': True + }) + return action_data + def truncate_data(self, cr, uid, data, context=None): data_list = data and data.split('\n') or [] if len(data_list) > 3: @@ -548,4 +592,4 @@ class mailgate_tool(osv.osv_memory): mailgate_tool() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mail_gateway/mail_gateway_view.xml b/addons/mail_gateway/mail_gateway_view.xml index 26a26980bea..706996ed55a 100644 --- a/addons/mail_gateway/mail_gateway_view.xml +++ b/addons/mail_gateway/mail_gateway_view.xml @@ -24,10 +24,13 @@ - + + - - +