Atul Patel(OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-import-outlook-pst-backlog-1-sgo into lp:~openerp-dev/openobject-addons/trunk-import-outlook-pst.
Requested reviews: Atul Patel(OpenERP) (atp-openerp) For more details, see: https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-import-outlook-pst-backlog-1-sgo/+merge/61932 hello, Create import_outlook_pst wizard read and extract pst file. thanks.. -- https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-import-outlook-pst-backlog-1-sgo/+merge/61932 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-import-outlook-pst.
=== added directory 'import_outlook_pst' === added file 'import_outlook_pst/__init__.py' --- import_outlook_pst/__init__.py 1970-01-01 00:00:00 +0000 +++ import_outlook_pst/__init__.py 2011-05-23 08:59:24 +0000 @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). +# +# 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 <http://www.gnu.org/licenses/>. +# +############################################################################## + +import import_outlook_pst +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === added file 'import_outlook_pst/__openerp__.py' --- import_outlook_pst/__openerp__.py 1970-01-01 00:00:00 +0000 +++ import_outlook_pst/__openerp__.py 2011-05-23 08:59:24 +0000 @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). +# +# 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 <http://www.gnu.org/licenses/>. +# +############################################################################## + +{ + 'name': 'Outlook Personal Storage table(Pst).', + 'version': '1.0', + 'category': 'Generic Modules', + 'description': """This Module read data from Outlook PST.""", + 'author': 'OpenERP SA', + 'website': 'http://www.openerp.com', + 'depends': ['base'], + 'init_xml': [], + 'update_xml': ['import_outlook_pst_view.xml'], + 'demo_xml': [], + 'test': [], + 'installable': True, + 'active': False, +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === added directory 'import_outlook_pst/demo' === added file 'import_outlook_pst/demo/contact.pst' Binary files import_outlook_pst/demo/contact.pst 1970-01-01 00:00:00 +0000 and import_outlook_pst/demo/contact.pst 2011-05-23 08:59:24 +0000 differ === added file 'import_outlook_pst/import_outlook_pst.py' --- import_outlook_pst/import_outlook_pst.py 1970-01-01 00:00:00 +0000 +++ import_outlook_pst/import_outlook_pst.py 2011-05-23 08:59:24 +0000 @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). +# +# 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 <http://www.gnu.org/licenses/>. +# +############################################################################## +from osv import fields, osv +import base64 +import subprocess +import os, os.path +import tempfile +from tools.translate import _ + +class import_outlook_pst(osv.osv): + """Import Outlook Pst""" + _name = "import.outlook.pst" + _description = __doc__ + _columns ={ + 'file': fields.binary('Upload pst File',filters='*.pst', required=True), + } + + def import_pst(self, cr, uid, ids, context=None): + """Extract pst file""" + if not context: + context = {} + for current in self.browse(cr, uid, ids): + parent_directory = tempfile.mkdtemp(prefix='outlook_', suffix='_pst') + outputdirectory = os.path.join(parent_directory, 'exctract_pst') + os.mkdir(outputdirectory) + pst_file = base64.decodestring(current.file) + att_folder_path = os.path.abspath(os.path.dirname("%temp%\\")) + att_path = os.path.join(att_folder_path,'exctract_file.pst') + file_pst = open(att_path, "w") + file_pst.write(pst_file) + file_pst.close() + try: + subprocess.call(['readpst', '-o', outputdirectory, '-r', att_path]) + except: + raise osv.except_osv(_('readpst lib Error!'), _('Please install readpst lib for reading pst file using sudo apt-get install readpst.')) + directories = [outputdirectory] + return {'type': 'ir.actions.act_window_close'} + +import_outlook_pst() === added file 'import_outlook_pst/import_outlook_pst_view.xml' --- import_outlook_pst/import_outlook_pst_view.xml 1970-01-01 00:00:00 +0000 +++ import_outlook_pst/import_outlook_pst_view.xml 2011-05-23 08:59:24 +0000 @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<openerp> + <data> + <record model="ir.ui.view" id="view_import_outlook_pst_form"> + <field name="name">import.outlook.pst.form</field> + <field name="model">import.outlook.pst</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="Import Outlook Pst"> + <group colspan="4"> + <separator string="Upload Your File:" colspan="4"/> + <field name="file"/> + <separator string="" colspan="4" /> + <group colspan="4" > + <label string="" colspan="2"/> + <button icon="gtk-cancel" special="cancel" string="_Cancel"/> + <button name="import_pst" string="Import" + type="object" icon="terp-camera_test"/> + </group> + </group> + </form> + </field> + </record> + + <record model="ir.actions.act_window" id="action_import_outlook_pst"> + <field name="name">Import Outlook Pst wizard </field> + <field name="res_model">import.outlook.pst</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form</field> + <field name="view_id" ref="view_import_outlook_pst_form"/> + <field name="target">new</field> + </record> + + <menuitem name="Outlook_PST" id="menu_outlook_pst" parent="base.menu_base_partner"/> + <menuitem name="Import Outlook Pst" id="menu_pst_contact" parent="menu_outlook_pst" action="action_import_outlook_pst" icon="STOCK_EXECUTE"/> + + </data> +</openerp> + +
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-web Post to : [email protected] Unsubscribe : https://launchpad.net/~openerp-dev-web More help : https://help.launchpad.net/ListHelp

