openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #00534
[Merge] lp:~openerp-dev/openobject-addons/jam-dev-addons1 into lp:~openerp-dev/openobject-addons/trunk-dev-addons1
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)
Improvements in Outlook and Thunderbird Plug ins:
- Outlook : Small Fix file output Destination Moved to temp
- Thunderbird/Outlook : Changed the Default List of Documents when outlook-addin is Registered
- Thunderbird/Outlook : Archiving the .eml file with the Document
- Thunderbird/Outlook : Open Document should also open Mail using references-ids as mail is part of discussion so that also consider,Test
--
https://code.launchpad.net/~openerp-dev/openobject-addons/jam-dev-addons1/+merge/41266
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/jam-dev-addons1.
=== modified file 'outlook/plugin/openerp-outlook-addin.exe'
Binary files outlook/plugin/openerp-outlook-addin.exe 2010-11-15 13:13:54 +0000 and outlook/plugin/openerp-outlook-addin.exe 2010-11-19 07:25:53 +0000 differ
=== modified file 'outlook/plugin/openerp-outlook-plugin/addin.py'
--- outlook/plugin/openerp-outlook-plugin/addin.py 2010-11-15 11:50:57 +0000
+++ outlook/plugin/openerp-outlook-plugin/addin.py 2010-11-19 07:25:53 +0000
@@ -50,121 +50,71 @@
d=Dispatch("Python.OpenERP.XMLRpcConn")
return d
class Configuration:
- def Init(self, application):
- self.mngr = None
-
- def Close(self):
- self.mngr = None
- self.close()
- win32ui.MessageBox("Configuration","Configuration")
def OnClick(self, button, cancel):
import win32ui
try:
- self.mngr = manager.GetManager()
- self.mngr.ShowManager()
+ mngr = manager.GetManager()
+ mngr.ShowManager()
except Exception,e:
win32ui.MessageBox("Fail to Initialize dialog.\n"+str(e),"OpenERP Configuration", win32con.MB_ICONERROR)
return cancel
#
class ViewPartners:
- def Init(self, application):
- self.mngr = None
- self.data = None
- self.outlook = None
- self.ex= None
-
- def Close(self):
- self.mngr = None
- self.data = None
- self.outlook = None
- self.ex= None
- self.close()
- win32ui.MessageBox("ViewPartners","ViewPartners")
-
def OnClick(self, button, cancel):
from win32com.client import Dispatch
import win32con
- self.mngr = manager.GetManager()
- self.data = self.mngr.LoadConfig()
- self.outlook = Dispatch("Outlook.Application")
- self.ex = self.outlook.ActiveExplorer()
- if self.ex:
+ mngr = manager.GetManager()
+ data = mngr.LoadConfig()
+ outlook = Dispatch("Outlook.Application")
+ ex = outlook.ActiveExplorer()
+ if ex:
is_login = str(data['login'])
if is_login == 'False':
win32ui.MessageBox("Please login to the database first", "OpenERP Connection", win32con.MB_ICONEXCLAMATION)
- elif self.ex.Selection.Count == 1 or ex.Selection.Count == 0:
- self.mngr = manager.GetManager()
- self.mngr.ShowManager("IDD_VIEW_PARTNER_DIALOG")
- elif self.ex.Selection.Count > 1:
+ elif ex.Selection.Count == 1 or ex.Selection.Count == 0:
+ mngr = manager.GetManager()
+ mngr.ShowManager("IDD_VIEW_PARTNER_DIALOG")
+ elif ex.Selection.Count > 1:
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","Open Contact",win32con.MB_ICONINFORMATION)
return cancel
#
class OpenPartner:
- def Init(self, application):
- self.mngr = None
- self.data = None
- self.outlook = None
- self.ex= None
-
- def Close(self):
- self.mngr = None
- self.data = None
- self.outlook = None
- self.ex= None
- self.close()
- win32ui.MessageBox("OpenPartner","OpenPartner")
-
def OnClick(self, button, cancel):
import win32ui
- from manager import ustr
- self.mngr = manager.GetManager()
- self.data = self.mngr.LoadConfig()
- self.outlook = Dispatch("Outlook.Application")
- self.ex = self.outlook.ActiveExplorer()
+ mngr = manager.GetManager()
+ data = mngr.LoadConfig()
+ outlook = Dispatch("Outlook.Application")
+ ex = outlook.ActiveExplorer()
if ex:
is_login = str(data['login'])
if is_login == 'False':
win32ui.MessageBox("Please login to the database first", "OpenERP Connection", win32con.MB_ICONEXCLAMATION)
- elif self.ex.Selection.Count == 1:
- self.mngr = manager.GetManager()
- self.mngr.ShowManager("IDD_OPEN_PARTNER_DIALOG")
- elif self.ex.Selection.Count == 0:
+ elif ex.Selection.Count == 1:
+ mngr = manager.GetManager()
+ mngr.ShowManager("IDD_OPEN_PARTNER_DIALOG")
+ elif ex.Selection.Count == 0:
win32ui.MessageBox("No mail selected to push to OpenERP","Push to OpenERP",win32con.MB_ICONINFORMATION)
- elif self.ex.Selection.Count > 1:
+ elif ex.Selection.Count > 1:
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","Push to OpenERP",win32con.MB_ICONINFORMATION)
return cancel
#
class OpenDocument:
- def Init(self, application):
- self.mngr = None
- self.data = None
- self.outlook = None
- self.ex= None
-
- def Close(self):
- self.mngr = None
- self.data = None
- self.outlook = None
- self.ex= None
- self.close()
- win32ui.MessageBox("OpenDocument","OpenDocument")
-
def OnClick(self, button, cancel):
from win32com.client import Dispatch
import win32con
- self.mngr = manager.GetManager()
- self.data = self.mngr.LoadConfig()
- self.outlook = Dispatch("Outlook.Application")
- self.ex = self.outlook.ActiveExplorer()
- if self.ex:
+ mngr = manager.GetManager()
+ data = mngr.LoadConfig()
+ outlook = Dispatch("Outlook.Application")
+ ex = outlook.ActiveExplorer()
+ if ex:
is_login = str(data['login'])
if is_login == 'False':
win32ui.MessageBox("Please login to the database first", "OpenERP Connection", win32con.MB_ICONEXCLAMATION)
- elif self.ex.Selection.Count == 1 or ex.Selection.Count == 0:
- self.mngr = manager.GetManager()
- self.mngr.ShowManager("IDD_OPEN_DOCUEMNT_DIALOG")
- elif self.ex.Selection.Count > 1:
+ elif ex.Selection.Count == 1 or ex.Selection.Count == 0:
+ mngr = manager.GetManager()
+ mngr.ShowManager("IDD_OPEN_DOCUEMNT_DIALOG")
+ elif ex.Selection.Count > 1:
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","Open Document",win32con.MB_ICONINFORMATION)
return cancel
#
=== modified file 'outlook/plugin/openerp-outlook-plugin/dialogs/dialog_map.py'
--- outlook/plugin/openerp-outlook-plugin/dialogs/dialog_map.py 2010-11-15 11:50:57 +0000
+++ outlook/plugin/openerp-outlook-plugin/dialogs/dialog_map.py 2010-11-19 07:25:53 +0000
@@ -272,15 +272,15 @@
return
setConnAttribs(server, port, self.mngr)
if str(NewConn.getitem('_running')) == 'False':
- msg = "No server running on host '%s' at port '%d'. Press ignore to still continue with this configuration?"%(server,port)
- r=win32ui.MessageBox(msg, "OpenERP Connection", win32con.MB_ABORTRETRYIGNORE | win32con.MB_ICONQUESTION)
- if r==3:
- resetConnAttribs(self.window)
- return
- elif r==4:
- self.OnClicked(id)
- elif r==5:
- setConnAttribs(server, port, self.mngr)
+ msg = "No server running on host '%s' at port '%d'. Press ignore to still continue with this configuration?"%(server,port)
+ r=win32ui.MessageBox(msg, "OpenERP Connection", win32con.MB_ABORTRETRYIGNORE | win32con.MB_ICONQUESTION)
+ if r==3:
+ resetConnAttribs(self.window)
+ return
+ elif r==4:
+ self.OnClicked(id)
+ elif r==5:
+ setConnAttribs(server, port, self.mngr)
win32gui.EndDialog(self.window.hwnd, id)
class DoneButtonProcessor(ButtonProcessor):
@@ -661,7 +661,6 @@
if not section:
win32ui.MessageBox("Documents can not be created.", "Documents Setting", flag_excl)
return
-
hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
partner_ids=[]
r = GetSelectedItems(hwndList)
=== modified file 'outlook/plugin/openerp-outlook-plugin/eml.py'
--- outlook/plugin/openerp-outlook-plugin/eml.py 2010-11-15 13:13:54 +0000
+++ outlook/plugin/openerp-outlook-plugin/eml.py 2010-11-19 07:25:53 +0000
@@ -25,7 +25,6 @@
import chilkat
import os
from manager import ustr
-import win32ui
import email
cemail = chilkat.CkEmail()
dt = chilkat.SYSTEMTIME()
@@ -34,7 +33,6 @@
body = mail.Body.encode("utf-8")
recipients = mail.Recipients
sender_email = mail.SenderEmailAddress
- sender_name = mail.SenderEmailAddress
attachments=mail.Attachments
cemail = chilkat.CkEmail()
@@ -69,7 +67,6 @@
att_file = os.path.join(attachments_folder_path, fn)
if os.path.exists(att_file):
os.remove(att_file)
- f1 = att_file
attachments[i].SaveAsFile(att_file)
contentType = cemail.addFileAttachment(att_file)
if (contentType == None ):
@@ -93,4 +90,4 @@
if (success == False):
print cemail.lastErrorText()
sys.exit()
- return new_mail
\ No newline at end of file
+ return new_mail, eml_path
\ No newline at end of file
=== modified file 'outlook/plugin/openerp-outlook-plugin/manager.py'
--- outlook/plugin/openerp-outlook-plugin/manager.py 2010-11-03 11:16:31 +0000
+++ outlook/plugin/openerp-outlook-plugin/manager.py 2010-11-19 07:25:53 +0000
@@ -104,10 +104,9 @@
self.application_directory = os.path.dirname(this_filename)
self.windows_data_directory = self.LocateDataDirectory()
self.data_directory = self.windows_data_directory
- self.default_objects = [('Partners','res.partner',''),('Partner Address','res.partner.address',''), \
- ('Account Invoices','account.invoice',''), ('Accounts','account.account',''), \
- ('Projects', 'project.project',''),('Sale Orders','sale.order',''), \
- ('Project Tasks','project.task',''), ('Products', 'product.product', '')]
+ self.default_objects = [('Partners','res.partner',''),('Account Invoices','account.invoice',''), \
+ ('Products', 'product.product',''),('Sale Orders','sale.order',''), \
+ ('Leads','crm.lead','')]
self.config=self.LoadConfig()
=== modified file 'outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py'
--- outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py 2010-11-15 13:13:54 +0000
+++ outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py 2010-11-19 07:25:53 +0000
@@ -80,25 +80,25 @@
self.protocol=None
def getitem(self, attrib):
- v=self.__getattribute__(attrib)
- return str(v)
+ v=self.__getattribute__(attrib)
+ return str(v)
def setitem(self, attrib, value):
return self.__setattr__(attrib, value)
def GetDBList(self):
- conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/db')
- try:
- db_list = execute(conn, 'list')
- if db_list == False:
- self._running=False
- return []
- else:
- self._running=True
- except:
- db_list=-1
- self._running=True
- return db_list
+ conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/db')
+ try:
+ db_list = execute(conn, 'list')
+ if db_list == False:
+ self._running=False
+ return []
+ else:
+ self._running=True
+ except:
+ db_list=-1
+ self._running=True
+ return db_list
def login(self,dbname, user, pwd):
self._dbname = dbname
@@ -133,35 +133,36 @@
break
def ArchiveToOpenERP(self, recs, mail):
- import win32con
+ import win32con
+ import win32ui
conn = xmlrpclib.ServerProxy(self._uri + '/xmlrpc/object')
flag = False
new_msg = ext_msg =""
message_id = referances = None
try:
- session = win32com.client.Dispatch("MAPI.session")
- session.Logon('Outlook')
- objMessage = session.GetMessage(mail.EntryID, mail.Parent.StoreID)
- objFields = objMessage.Fields
- strheader = objFields.Item(mapitags.PR_TRANSPORT_MESSAGE_HEADERS)
- strheader = ustr(strheader).encode('iso-8859-1')
- headers = {}
- strheader = strheader.replace("\n ", " ").splitlines()
- for line in strheader:
- split_here = line.find(":")
- headers[line[:split_here]] = line[split_here:]
- temp1 = headers.get('Message-ID')
- temp2 = headers.get('Message-Id')
- referances = headers.get('References')
- if temp1 == None: message_id = temp2
- if temp2 == None: message_id = temp1
- startCut = message_id.find("<")
- endCut = message_id.find(">")
- message_id = message_id[startCut:endCut+1]
- if not referances == None:
- startCut = referances.find("<")
- endCut = referances.find(">")
- referances = referances[startCut:endCut+1]
+ session = win32com.client.Dispatch("MAPI.session")
+ session.Logon('Outlook')
+ objMessage = session.GetMessage(mail.EntryID, mail.Parent.StoreID)
+ objFields = objMessage.Fields
+ strheader = objFields.Item(mapitags.PR_TRANSPORT_MESSAGE_HEADERS)
+ strheader = ustr(strheader).encode('iso-8859-1')
+ headers = {}
+ strheader = strheader.replace("\n ", " ").splitlines()
+ for line in strheader:
+ split_here = line.find(":")
+ headers[line[:split_here]] = line[split_here:]
+ temp1 = headers.get('Message-ID')
+ temp2 = headers.get('Message-Id')
+ referances = headers.get('References')
+ if temp1 == None: message_id = temp2
+ if temp2 == None: message_id = temp1
+ startCut = message_id.find("<")
+ endCut = message_id.find(">")
+ message_id = message_id[startCut:endCut+1]
+ if not referances == None:
+ startCut = referances.find("<")
+ endCut = referances.find(">")
+ referances = referances[startCut:endCut+1]
except Exception,e:
win32ui.MessageBox(str(e),"Archive To OpenERP")
return
@@ -195,7 +196,7 @@
}
obj_list= ['crm.lead','project.issue','hr.applicant','res.partner']
if rec[0] not in obj_list:
- ids = self.CreateEmailAttachment(rec,mail)
+ self.CreateEmailAttachment(rec,mail)
result = {}
if attachments:
result = self.MakeAttachment([rec], mail)
@@ -269,7 +270,7 @@
id = -1
try:
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
- email=eml.generateEML(mail)
+ email, path = eml.generateEML(mail)
message_id = None
session = win32com.client.Dispatch("MAPI.session")
session.Logon('Outlook')
@@ -447,11 +448,21 @@
return True
def SearchEmailResources(self, message_id):
+ import win32ui
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
res_vals = []
mail_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mailgate.message', 'search', [('message_id','=',message_id)])
+ ref_mail_id = None
if not mail_id:
- return None
+ ref_mail_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mailgate.message', 'search', [('references','=',message_id)])
+ if ref_mail_id:
+ win32ui.MessageBox(str(ref_mail_id),"ref_mail_id")
+ address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mailgate.message','read',ref_mail_id[0],['model','res_id'])
+ win32ui.MessageBox(str(address),"address")
+ for key, vals in address.items():
+ res_vals.append([key,vals])
+ return res_vals
+ return None
address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mailgate.message','read',mail_id[0],['model','res_id'])
for key, vals in address.items():
res_vals.append([key,vals])
@@ -507,6 +518,8 @@
return country
def CreateEmailAttachment(self, rec, mail):
+ import eml
+ email, path = eml.generateEML(mail)
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
obj = rec[0]
obj_id = rec[1]
@@ -524,16 +537,12 @@
l = 64 - len(fn)
f = fn.split('.')
fn = f[0][0:l] + '.' + f[-1]
- fn = fn[:-4]+'.txt'
- f = open(fn,"w")
- body = mail.Body.encode("utf-8")
- f.writelines(body)
- f.close()
- f=open(fn,"rb")
+ fn = fn[:-4]+".eml"
+ f = open(path)
content = "".join(f.readlines()).encode('base64')
f.close()
- res['name'] = ustr((mail.Subject).replace(' ',''))
- res['datas_fname'] = ustr(fn)
+ res['name'] = fn
+ res['datas_fname'] = fn
res['datas'] = content
res['res_id'] = obj_id
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','create',res)
=== modified file 'thunderbird/partner/partner.py'
--- thunderbird/partner/partner.py 2010-11-11 10:05:20 +0000
+++ thunderbird/partner/partner.py 2010-11-19 07:25:53 +0000
@@ -148,6 +148,7 @@
dictcreate = dict(vals)
ref_ids = str(dictcreate.get('ref_ids')).split(';')
msg = dictcreate.get('message')
+ mail = msg
msg = self.pool.get('email.server.tools').parse_message(msg)
server_tools_pool = self.pool.get('email.server.tools')
message_id = msg.get('message-id', False)
@@ -183,11 +184,11 @@
l = 64 - len(fn)
f = fn.split('.')
fn = f[0][0:l] + '.' + f[-1]
- fn = fn[:-4]+'.txt'
+ fn = fn[:-4]+'.eml'
res['res_model'] = model
- res['name'] = msg.get('subject','NO-SUBJECT')
+ res['name'] = msg.get('subject','NO-SUBJECT')+".eml"
res['datas_fname'] = fn
- res['datas'] = base64.b64encode(msg.get('body'))
+ res['datas'] = base64.b64encode(mail)
res['res_id'] = res_id
obj_attch.create(cr, uid, res)
server_tools_pool.history_message(cr, uid, model, res_id, msg_new)
@@ -203,8 +204,15 @@
def search_message(self, cr, uid, message, context=None):
#@param message: string of mail which is read from EML File
#@return model,res_id
+ references = []
dictcreate = dict(message)
- message_id = dictcreate.get('message_id')
+ msg = dictcreate.get('message')
+ msg = self.pool.get('email.server.tools').parse_message(msg)
+ message_id = msg.get('message-id')
+ refs = msg.get('references',False)
+ references = False
+ if refs:
+ references = refs.split()
msg_pool = self.pool.get('mailgate.message')
model = ''
res_id = 0
@@ -214,6 +222,13 @@
msg = msg_pool.browse(cr, uid, msg_ids[0])
model = msg.model
res_id = msg.res_id
+ else:
+ if references :
+ msg_ids = msg_pool.search(cr, uid, [('message_id','in',references)])
+ if msg_ids and len(msg_ids):
+ msg = msg_pool.browse(cr, uid, msg_ids[0])
+ model = msg.model
+ res_id = msg.res_id
return (model,res_id)
=== modified file 'thunderbird/plugin/openerp_plugin.xpi'
Binary files thunderbird/plugin/openerp_plugin.xpi 2010-11-03 13:18:28 +0000 and thunderbird/plugin/openerp_plugin.xpi 2010-11-19 07:25:53 +0000 differ
=== modified file 'thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar'
Binary files thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar 2010-11-03 13:18:28 +0000 and thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar 2010-11-19 07:25:53 +0000 differ
=== modified file 'thunderbird/plugin/openerp_plugin/defaults/preferences/tiny.js'
--- thunderbird/plugin/openerp_plugin/defaults/preferences/tiny.js 2010-10-04 12:23:45 +0000
+++ thunderbird/plugin/openerp_plugin/defaults/preferences/tiny.js 2010-11-19 07:25:53 +0000
@@ -24,9 +24,9 @@
pref("extensions.tiny.officeno","");
pref("extensions.tiny.phoneno","");
pref("extensions.tiny.address","");
-pref("extensions.tiny.listobject","Partner,Partner Address,Accout Invoice,Project,Product,Account,Sale Order,Project Task");
-pref("extensions.tiny.object","res.partner,res.partner.address,account.invoice,project.project,product.product,account.account,sale.order,project.task");
-pref("extensions.tiny.imagename","chrome://openerp_plugin/skin/Partner.png,chrome://openerp_plugin/skin/Contact.png,chrome://openerp_plugin/skin/Invoice.png,chrome://openerp_plugin/skin/Project.png,chrome://openerp_plugin/skin/Product.png,chrome://openerp_plugin/skin/Account.png,chrome://openerp_plugin/skin/Sale.png,chrome://openerp_plugin/skin/Case.png,chrome://openerp_plugin/skin/Task.png");
+pref("extensions.tiny.listobject","Partner,Accout Invoice,Product,Sale Order,Lead and opportunities");
+pref("extensions.tiny.object","res.partner,account.invoice,product.product,sale.order,crm.lead");
+pref("extensions.tiny.imagename","chrome://openerp_plugin/skin/Partner.png,chrome://openerp_plugin/skin/Invoice.png,chrome://openerp_plugin/skin/Product.png,chrome://openerp_plugin/skin/Sale.png,chrome://openerp_plugin/skin/Case.png");
pref("extensions.tiny.attachmentlength","");
pref("extensions.tiny.attachment","");
pref("extensions.tiny.db_list","false");
Follow ups