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 @@
-
+
+
-
-
+
+
+
+
@@ -53,6 +56,8 @@
+
+
diff --git a/addons/mail_gateway/wizard/__init__.py b/addons/mail_gateway/wizard/__init__.py
deleted file mode 100644
index fe5faaa7254..00000000000
--- a/addons/mail_gateway/wizard/__init__.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-import mail_gateway_document
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/mail_gateway/wizard/mail_gateway_document.py b/addons/mail_gateway/wizard/mail_gateway_document.py
deleted file mode 100644
index 55bdc698b8b..00000000000
--- a/addons/mail_gateway/wizard/mail_gateway_document.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-from osv import fields, osv
-
-class mail_gateway_document(osv.osv_memory):
- """ Mail Gateway Document """
- _name = "mail.gateway.document"
- _description = "Mail Gateway Document"
-
-
- 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 or list of IDs if we want more than one
- @param context: A standard dictionary
- """
- result = []
- document_id = context.get('active_id', False)
- mailgate_obj = self.pool.get('mailgate.message')
- mailgate_data = mailgate_obj.browse(cr, uid, document_id)
- model = mailgate_data.model
- res_id = mailgate_data.res_id
-
- view_obj = self.pool.get('ir.ui.view')
- view_id = view_obj.search(cr, uid, [('model', '=', model),('type','=','tree')])
- return {
- 'domain' : "[('id','=',%d)]"%(res_id),
- 'view_mode': 'tree,form',
- 'view_type': 'form',
- 'view_id': view_id or False,
- 'res_model': model,
- 'res_id': res_id,
- 'context': context,
- 'type': 'ir.actions.act_window',
- }
-
-mail_gateway_document()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mail_gateway/wizard/mail_gateway_document_view.xml b/addons/mail_gateway/wizard/mail_gateway_document_view.xml
deleted file mode 100644
index 13dc97b9fa8..00000000000
--- a/addons/mail_gateway/wizard/mail_gateway_document_view.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
- Open Document
- mail.gateway.document
- form
-
-
-
-
-
-
- Open Document
- ir.actions.act_window
- mail.gateway.document
- form
- form
- new
-
-
-
-
-
-
\ No newline at end of file