jam-openerp has proposed merging lp:~openerp-dev/openobject-addons/jam-dev-addons1 into lp:~openerp-dev/openobject-addons/trunk-dev-addons1.
Requested reviews: Harry (Open ERP) (hmo-tinyerp) [FIX] Outlook : Archive Text File with the Document. Mail Bosy Encoding Problem. [IMP] Outlook: Added exe for Plugin installation of the outlook-addin and removed old zip file and also changes in Outlook installer file of the Outlook module. -- https://code.launchpad.net/~openerp-dev/openobject-addons/jam-dev-addons1/+merge/40623 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/jam-dev-addons1.
=== modified file 'outlook/README' --- outlook/README 2010-10-11 10:41:04 +0000 +++ outlook/README 2010-11-11 13:16:14 +0000 @@ -2,31 +2,22 @@ Pre requirements : ====================================================================================== -1.Python 2.6+ . python can be downloaded from http://www.python.org/download/releases/ . -2.Python for Windows extensions - PyWin32 this module for python must be installed for appropriate version of the Python. It can be downloaded from http://sourceforge.net/projects/pywin32/files/ or http://starship.python.net/crew/mhammond/win32/ -3.If you are using MS Outlook 2007 than you are required to install "Microsoft Exchange Server MAPI Client and Collaboration Data Objects 1.2.1 (CDO 1.21)". It can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=e17e7f31-079a-43a9-bff2-0a110307611e&displaylang=en + 1.Python 2.6+ . python can be downloaded from http://www.python.org/download/releases/ . + 2.Python for Windows extensions - PyWin32 this module for python must be installed for appropriate version of the Python. It can be downloaded from http://sourceforge.net/projects/pywin32/files/ or http://starship.python.net/crew/mhammond/win32/ + 3.If you are using MS Outlook 2007 than you are required to install "Microsoft Exchange Server MAPI Client and Collaboration Data Objects 1.2.1 (CDO 1.21)". It can be downloaded from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=e17e7f31-079a-43a9-bff2-0a110307611e&displaylang=en How to install openerp-outlook plug-in? ====================================================================================== -1.Open your Python installation directory (e.g.: C:\Python26). -2.Create folder named âopenerp-outlook-pluginâ. -3.Extract your zip file âoutlook-plugin.zipâ to the folder. -4.Open the folder outlook-plugin. -5.And Run âRegister-plugin.batâ file. -6.Run Outlook and Check addin has been registered. -7.Tools->OpenERP Configuration and test your connection. -8.See User Guide for More. + 1. Save the executable plug-in file. + 2. Close Outlook Application if Running. + 3. Run executable plug-in file and the folllow the instruction. How to uninstall openerp-outlook plug-in? ===================================================================================== -1.Open the folder outlook-plugin. -2.And Run âUnregister-plugin.batâ file. + 1. Go to Control Panel Click "Add/Remove Programmes" + 2. You will entry, you will find entry named 'OpenERP Outlook Addin 1.0' select it and click Uninstall. Note : Plug In has been successfully tested with MS Office 2003 and MS Offcie 2007. - Enjoy Archiving your Outlook E-mails to OpenERP. - - - === modified file 'outlook/installer.py' --- outlook/installer.py 2010-10-26 13:22:54 +0000 +++ outlook/installer.py 2010-11-11 13:16:14 +0000 @@ -32,7 +32,7 @@ def default_get(self, cr, uid, fields, context={}): data = super(outlook_installer, self).default_get(cr, uid, fields, context) data['doc_file'] = 'http://doc.openerp.com/book/2/2_6_Comms/2_6_Comms_outlook.html' - file = open(addons.get_module_resource('outlook','plugin','openerp-outlook-plugin.zip'), 'r') + file = open(addons.get_module_resource('outlook','plugin','openerp-outlook-addin.exe'), 'r') data['plugin_file'] = base64.encodestring(file.read()) return data @@ -47,7 +47,7 @@ _defaults = { 'outlook' : True, - 'name' : 'OpenERP-Outlook-PlugIn.zip', + 'name' : 'Openerp-Outlook-Addin v1.exe', 'doc_name' : 'Installation Guide to OpenERP Outlook Plug-in.doc', 'description' : """ * Save the Outlook plugÂ-in. @@ -58,15 +58,10 @@ 3. If you are using MS Outlook 2007 than you are required to install "Microsoft Exchange Server MAPI Client and Collaboration Data Objects 1.2.1 (CDO 1.21)". How to install openerp-outlook plug-in? - 1. Extract zip file âopenerp-outlook-plugin.zipâ . - 2. Open the folder openerp-outlook-plugin. - 3. Run âRegister-plugin.batâ file. - 4. Run Outlook and Check addon has been registered. - 5. Tools->OpenERP Configuration and test your connection. - 6. See User Guide for more information. - 7. Keep All extratced files in some safe places - (e.g. python installation Directory "C:\pythonXX\" or Windows installation Directory "C:\Program Files\" ). - + 1. Save the executable plug-in file. + 2. Close Outlook Application if Running. + 3. Run executable plug-in file and the folllow the instruction. + Note : Please refer README file for dependecies external link, openobject-addons/outlook/README. """ === added file 'outlook/plugin/openerp-outlook-addin.exe' Binary files outlook/plugin/openerp-outlook-addin.exe 1970-01-01 00:00:00 +0000 and outlook/plugin/openerp-outlook-addin.exe 2010-11-11 13:16:14 +0000 differ === removed file 'outlook/plugin/openerp-outlook-plugin.zip' Binary files outlook/plugin/openerp-outlook-plugin.zip 2010-11-10 10:08:04 +0000 and outlook/plugin/openerp-outlook-plugin.zip 1970-01-01 00:00:00 +0000 differ === modified file 'outlook/plugin/openerp-outlook-plugin/addin.py' --- outlook/plugin/openerp-outlook-plugin/addin.py 2010-11-11 10:37:46 +0000 +++ outlook/plugin/openerp-outlook-plugin/addin.py 2010-11-11 13:16:14 +0000 @@ -31,32 +31,29 @@ import os from win32com.client import Dispatch import win32con - sys.path.append(os.path.abspath(os.path.dirname(__file__))) #outlook sys.path.append(os.path.abspath(__file__)) #outlook/addin - import manager from win32com.client import CastTo import win32ui +<<<<<<< TREE from tiny_xmlrpc import XMLRpcConn +======= +from tiny_xmlrpc import XMLRpcConn +>>>>>>> MERGE-SOURCE import locale locale.setlocale(locale.LC_NUMERIC, "C") - # Support for COM objects we use. gencache.EnsureModule('{00062FFF-0000-0000-C000-000000000046}', 0, 9, 0, bForDemand=True) # Outlook 9 gencache.EnsureModule('{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}', 0, 2, 1, bForDemand=True) # Office 9 - # The TLB defiining the interfaces we implement universal.RegisterInterfaces('{AC0714F2-3D04-11D1-AE7D-00A0C90F26F4}', 0, 1, 0, ["_IDTExtensibility2"]) - global NewConn - # Retrieves registered XMLRPC connection def GetConn(): d=Dispatch("Python.OpenERP.XMLRpcConn") return d - class Configuration: def OnClick(self, button, cancel): try: @@ -279,7 +276,6 @@ _winreg.SetValueEx(subkey, "FriendlyName", 0, _winreg.REG_SZ, klass._reg_progid_) if __name__ == '__main__': - import win32com.server.register NewConn=XMLRpcConn() win32com.server.register.UseCommandLine(OutlookAddin) === modified file 'outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py' --- outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py 2010-11-11 10:37:46 +0000 +++ outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py 2010-11-11 13:16:14 +0000 @@ -32,7 +32,6 @@ waittime = 10 wait_count = 0 wait_limit = 12 - def execute(connector, method, *args): global wait_count res = False @@ -168,6 +167,7 @@ return attachments=mail.Attachments for rec in recs: #[('res.partner', 3, 'Agrolait')] +<<<<<<< TREE model = rec[0] res_id = rec[1] #Check if mailgate installed @@ -203,6 +203,44 @@ attachment_ids = result.get(model, {}).get(res_id, []) new_msg += """- {0} : {1}\n""".format(object_name,str(rec[2])) flag = True +======= + model = rec[0] + res_id = rec[1] + #Check if mailgate installed + object_id = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=','mailgate.message')]) + if not object_id: + win32ui.MessageBox("Mailgate is not installed on your configured database '%s' !!\n\nPlease install it to archive the mail."%(self._dbname),"Mailgate not installed",win32con.MB_ICONERROR) + return + object_ids = execute ( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','search',[('model','=',model)]) + object_name = execute( conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.model','read',object_ids,['name'])[0]['name'] + #Reading the Object ir.model Name + ext_ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'mailgate.message','search',[('message_id','=',message_id),('model','=',model),('res_id','=',res_id)]) + if ext_ids: + name = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,model,'read',res_id,['name'])['name'] + ext_msg += """This mail is already archived to {0} '{1}'.\n""".format(object_name,name) + flag = True + continue + msg = { + 'subject':mail.Subject, + 'date':str(mail.ReceivedTime), + 'body':mail.Body, + 'cc':mail.CC, + 'from':mail.SenderEmailAddress, + 'to':mail.To, + 'message-id':message_id, + 'references':ustr(referances), + } + obj_list= ['crm.lead','project.issue','hr.applicant','res.partner'] + if rec[0] not in obj_list: + ids = self.CreateEmailAttachment(rec,mail) + result = {} + if attachments: + result = self.MakeAttachment([rec], mail) + attachment_ids = result.get(model, {}).get(res_id, []) + ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','history',model, res_id, msg, attachment_ids) + new_msg += """- {0} : {1}\n""".format(object_name,str(rec[2])) + flag = True +>>>>>>> MERGE-SOURCE if flag: t = """Mail archived Successfully with attachments.\n"""+ext_msg @@ -505,20 +543,19 @@ object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','read',ids)[0] country = object['country_id'][1] return country +<<<<<<< TREE def CreateEmailAttachment(self, rec, email): +======= + def CreateEmailAttachment(self, rec, mail): + result = {} +>>>>>>> MERGE-SOURCE conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object') - att_folder_path = os.path.abspath(os.path.dirname("%temp%\\")) - if not os.path.exists(att_folder_path): - os.makedirs(att_folder_path) obj = rec[0] obj_id = rec[1] res={} res['res_model'] = obj ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n',':','~'] - sub = (email.Subject).replace(' ','') - if sub.strip() == '': - sub = 'NO SBUJECT' - fn = sub + fn = (mail.Subject).replace(' ','') for c in ls: fn = fn.replace(c,'') if len(fn) > 64: @@ -529,14 +566,23 @@ l = 64 - len(fn) f = fn.split('.') fn = f[0][0:l] + '.' + f[-1] +<<<<<<< TREE fn = fn+'.txt' +======= + fn = fn[:-4]+'.txt' +>>>>>>> MERGE-SOURCE f=open(fn,"w") - f.writelines(ustr(email.Body).encode('iso-8859-1')) + body = mail.Body.encode("utf-8") + f.writelines(body) f.close() - f=open(fn,"r") + f=open(fn,"rb") content = "".join(f.readlines()).encode('base64') f.close() +<<<<<<< TREE res['name'] = ustr(sub) +======= + res['name'] = ustr((mail.Subject).replace(' ','')) +>>>>>>> MERGE-SOURCE res['datas_fname'] = ustr(fn) res['datas'] = content res['res_id'] = obj_id
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : [email protected] Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp

