[IMP] Outlook Improvements

bzr revid: jam@tinyerp.com-20101217062852-bqdmewmhsswavz77
This commit is contained in:
jam-openerp
2010-12-17 11:58:52 +05:30
parent 24b92f599f
commit fce3cd4fee
3 changed files with 22 additions and 16 deletions
@@ -204,8 +204,6 @@ class OutlookAddin:
item.TooltipText = "Click to Open Document that has been pushed to server."
item.Enabled = True
# Hook events for the item
# item = toolbarweb.Controls.Add(Type = constants.msoControlButton, Temporary = True)
# item = self.toolbarButtonPartner = DispatchWithEvents(item, ViewPartners)
@@ -705,22 +705,18 @@ def GetSearchText(txtProcessor,*args):
b = check()
if not b:
return
search_box = txtProcessor.GetControl()
global search_text
if txtProcessor.init_done:
win32gui.SendMessage(search_box, win32con.WM_SETTEXT, 0,search_text)
return
# Get the selected mail and set the default value for search_text_control to mail.SenderEmailAddress
ex = txtProcessor.window.manager.outlook.ActiveExplorer()
assert ex.Selection.Count == 1
mail = ex.Selection.Item(1)
try:
search_text = ustr(mail.SenderEmailAddress).encode('iso-8859-1')
except Exception:
pass
win32gui.SendMessage(search_box, win32con.WM_SETTEXT, 0, search_text)
global objects_with_match
list_hwnd = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[1])
objects_with_match = NewConn.SearchPartners()
setList(list_hwnd)
except Exception,e:
msg=getMessage(e)
win32ui.MessageBox('Document can not be loaded.\n'+str(e), "Push", flag_error)
txtProcessor.init_done=True
def SetNameColumn(listProcessor,*args):
@@ -1695,12 +1691,13 @@ dialog_map = {
(CommandButtonProcessor, "ID_SEARCH ID_SEARCH_TEXT IDC_NAME_LIST", SearchObjectsForText,()),
(GroupProcessor, "IDC_STATIC_GROUP", setCheckList, ()),
(CSComboProcessor, "ID_ATT_METHOD_DROPDOWNLIST", GetConn,()),
(TextProcessor, "ID_SEARCH_TEXT", GetSearchText, ()),
(DialogCommand, "ID_CREATE_CONTACT ID_SEARCH_TEXT", "IDD_NEW_CONTACT_DIALOG", set_search_text, ()),
(CloseButtonProcessor, "IDCANCEL"),
(CommandButtonProcessor, "ID_MAKE_ATTACHMENT IDC_NAME_LIST IDD_SYNC", MakeAttachment, ()),
(CommandButtonProcessor, "ID_CREATE_CASE ID_ATT_METHOD_DROPDOWNLIST IDC_NAME_LIST IDD_SYNC", CreateCase, ()),
(ListBoxProcessor, "IDC_NAME_LIST", SetNameColumn, ())
(ListBoxProcessor, "IDC_NAME_LIST", SetNameColumn, ()),
(TextProcessor, "ID_SEARCH_TEXT ID_SEARCH_TEXT IDC_NAME_LIST", GetSearchText, ()),
),
"IDD_NEW_CONTACT_DIALOG" : (
@@ -59,7 +59,7 @@ class XMLRpcConn(object):
'ArchiveToOpenERP', 'IsCRMInstalled', 'GetPartners', 'GetObjectItems', \
'CreateCase', 'MakeAttachment', 'CreateContact', 'CreatePartner', 'getitem', 'setitem', \
'SearchPartnerDetail', 'WritePartnerValues', 'GetAllState', 'GetAllCountry', 'SearchPartner', 'SearchEmailResources', \
'GetCountry', 'GetStates', 'FindCountryForState','CreateEmailAttachment']
'GetCountry', 'GetStates', 'FindCountryForState','CreateEmailAttachment','SearchPartners']
_reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER
_reg_clsid_ = "{C6399AFD-763A-400F-8191-7F9D0503CAE2}"
_reg_progid_ = "Python.OpenERP.XMLRpcConn"
@@ -550,3 +550,14 @@ class XMLRpcConn(object):
res['res_id'] = obj_id
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'ir.attachment','create',res)
return id
def SearchPartners(self):
res = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
obj = 'res.partner'
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'search',[])
recs = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,obj,'read',ids,['id','name'])
for rec in recs:
name = ustr(rec['name'])
res.append((obj,rec['id'],name,obj))
return res