[IMP]Outlook-Plugin -

bzr revid: jam@tinyerp.com-20101030111416-l00m9d32yu2s3gov
This commit is contained in:
jam-openerp
2010-10-30 16:44:16 +05:30
parent aee5da48f7
commit 9d44b90544
20 changed files with 127 additions and 68 deletions
+13 -13
View File
@@ -60,7 +60,7 @@ def GetConn():
mngr = manager.GetManager()
return d
class ButtonEvent:
class Configuration:
def OnClick(self, button, cancel):
import win32ui
try:
@@ -170,7 +170,7 @@ class OutlookAddin:
item = tools_menu.Controls.Add(Type=constants.msoControlButton, Temporary=True)
# Hook events for the item
item = self.menu_bar_Button = DispatchWithEvents(item, ButtonEvent)
item = self.menu_bar_Button = DispatchWithEvents(item, Configuration)
item.Caption="OpenERP Configuration"
item.TooltipText = "Click to configure OpenERP"
item.Enabled = True
@@ -209,19 +209,19 @@ class OutlookAddin:
item.Enabled = True
# Hook events for the item
item = toolbarweb.Controls.Add(Type = constants.msoControlButton, Temporary = True)
item = self.toolbarButtonPartner = DispatchWithEvents(item, ViewPartners)
item.Caption = "Open Contact"
item.TooltipText = "Click to Open OpenERP Partner Contact Information."
item.Enabled = True
# item = toolbarweb.Controls.Add(Type = constants.msoControlButton, Temporary = True)
# item = self.toolbarButtonPartner = DispatchWithEvents(item, ViewPartners)
# item.Caption = "Open Contact"
# item.TooltipText = "Click to Open OpenERP Partner Contact Information."
# item.Enabled = True
item = tools_menu.Controls.Add(Type=constants.msoControlButton, Temporary=True)
# Hook events for the item
item = self.menu_bar_viewpartner_Button = DispatchWithEvents(item, ViewPartners)
item.Caption = "Open Contact"
item.TooltipText = "Click to Open Partner detail"
item.Enabled = True
# item = tools_menu.Controls.Add(Type=constants.msoControlButton, Temporary=True)
# # Hook events for the item
# item = self.menu_bar_viewpartner_Button = DispatchWithEvents(item, ViewPartners)
# item.Caption = "Open Contact"
# item.TooltipText = "Click to Open Partner detail"
# item.Enabled = True
item = tools_menu.Controls.Add(Type=constants.msoControlButton, Temporary=True)
# Hook events for the item
-1
View File
@@ -3790,7 +3790,6 @@ class CkSpider(_object):
def CanonicalizeUrl(self, *args): return _chilkat.CkSpider_CanonicalizeUrl(self, *args)
def getDomain(self, *args): return _chilkat.CkSpider_getDomain(self, *args)
def getBaseDomain(self, *args): return _chilkat.CkSpider_getBaseDomain(self, *args)
def canonicalizeUrl(self, *args): return _chilkat.CkSpider_canonicalizeUrl(self, *args)
def lastErrorText(self): return _chilkat.CkSpider_lastErrorText(self)
def lastErrorXml(self): return _chilkat.CkSpider_lastErrorXml(self)
View File
+49 -17
View File
@@ -438,8 +438,6 @@ def TestConnection(btnProcessor,*args):
win32ui.MessageBox("No database found on host "+ server+" at port "+str(port), "OpenERP Connection", flag_excl)
return
uname = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
pwd = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
@@ -765,9 +763,6 @@ def SearchObjectsForText(btnProcessor,*args):
return
search_txt = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
if not search_txt:
win32ui.MessageBox("Enter text to search for", "Push to OpenERP", flag_info)
return
# Get titles from list
obj_titles=[]
for ch in hwndChk_list:
@@ -845,6 +840,9 @@ def CreateContact(btnProcessor,*args):
'state_id':ustr(state),
'country_id':ustr(country)
}
if res.get('name').strip == '' or res.get('email').strip == '':
win32ui.MessageBox("Contact name or Email id is Missing\nPlease fill those information", "Create Contact", flag_error)
return
try:
id = NewConn.CreateContact(str(res))
if not partner:
@@ -1106,6 +1104,8 @@ def GetDefaultEmail(txtProcessor,*args):
new_con_state = ""
if country_ref == None:
country_ref = ""
if not b:
return
#Acquiring control of the text box
@@ -1314,6 +1314,17 @@ def SetPartnerNameColumn(listProcessor,*args):
lvc.text = "Partner Name"
lvc.cx = 275
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
partners = list(NewConn.GetPartners(''))
win32gui.SendMessage(hwndList, commctrl.LVM_DELETEALLITEMS)
if not partners:
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0],"<enter text to search>")
win32ui.MessageBox("No Partner found with name {0}.".format(search_partner),"Search Partner",flag_error)
for partner in partners[::-1]:
num_items = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMCOUNT)
item = LVITEM(text=partner[1],iItem = num_items)
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTITEM, 0, item.toparam())
listProcessor.init_done = True
def SelectPartnerFromList(btnProcessor,*args):
@@ -1354,9 +1365,6 @@ def SearchPartnerList(btnProcessor,*args):
return
try :
search_partner = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
if not search_partner:
win32ui.MessageBox("Please enter Partner name to search for.", "Search Partner", flag_excl)
return
#Searching the contact.
hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
partners = list(NewConn.GetPartners(search_partner))
@@ -1364,7 +1372,7 @@ def SearchPartnerList(btnProcessor,*args):
if not partners:
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0],"<enter text to search>")
win32ui.MessageBox("No Partner found with name {0}.".format(search_partner),"Search Partner",flag_error)
for partner in partners:
for partner in partners[::-1]:
num_items = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMCOUNT)
item = LVITEM(text=partner[1],iItem = num_items)
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTITEM, 0, item.toparam())
@@ -1396,12 +1404,18 @@ def OpenPartnerForm(txtProcessor,*args):
partner_text = ""
try:
partner_text = ustr(mail.SenderName).encode('iso-8859-1')
sender_mail = ustr(mail.SenderEmailAddress).encode('iso-8859-1')
except Exception,e:
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, "< Error in reading email.>")
pass
vals = NewConn.SearchPartner(partner_text)
vals = NewConn.SearchPartner(sender_mail)
if vals == True:
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, "< Their is contact related to "+str(partner_text)+" email address, but no partner is linked to contact>")
txtProcessor.init_done=True
return
if vals == None:
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, "< No Partner with named "+str(partner_text)+" found.>")
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, "< No Partner found linked to "+str(partner_text)+" email address.>")
txtProcessor.init_done=True
return
global web_server
@@ -1442,6 +1456,7 @@ def SerachOpenDocuemnt(txtProcessor,*args):
txtProcessor.init_done=True
return
linktodoc = ""
message_id = None
try:
outlook = win32com.client.Dispatch("Outlook.Application")
@@ -1484,9 +1499,6 @@ def SearchCountry(btnProcessor, *args):
return
try :
search_country = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
if not search_country:
win32ui.MessageBox("Please enter country name to search for.", "Search Country", flag_excl)
return
#Searching the contact.
hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
countries = list(NewConn.GetCountry(search_country))
@@ -1520,6 +1532,17 @@ def SetCountryList(listProcessor,*args):
lvc.text = "Country Name"
lvc.cx = 275
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
countries = list(NewConn.GetCountry(''))
win32gui.SendMessage(hwndList, commctrl.LVM_DELETEALLITEMS)
if not countries:
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0],"<enter text to search>")
win32ui.MessageBox("No country found with name {0}.".format(search_country),"Search Country",flag_error)
for country in countries:
num_items = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMCOUNT)
item = LVITEM(text=country[1],iItem = num_items)
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTITEM, 0, item.toparam())
listProcessor.init_done = True
def SelectCountryFromList(btnProcessor,*args):
@@ -1566,9 +1589,6 @@ def SearchState(btnProcessor, *args):
global new_con_country
global search_country
search_state = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
if not search_state:
win32ui.MessageBox("Please enter state name to search for.", "Search Fed.State", flag_excl)
return
#Searching the contact.
hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
states = list(NewConn.GetStates(search_state, search_country))
@@ -1601,6 +1621,18 @@ def SetStateList(listProcessor,*args):
lvc.text = "Fed.State Name"
lvc.cx = 275
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
global new_con_country
global search_country
states = list(NewConn.GetStates('', search_country))
win32gui.SendMessage(hwndList, commctrl.LVM_DELETEALLITEMS)
if not states:
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0],"<enter text to search>")
win32ui.MessageBox("No state found with name {0}.".format(search_state),"Search Fed.State",flag_error)
for state in states:
num_items = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMCOUNT)
item = LVITEM(text=state[1],iItem = num_items)
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTITEM, 0, item.toparam())
listProcessor.init_done = True
def SelectStateFromList(btnProcessor,*args):
View File
View File
+4 -4
View File
@@ -227,10 +227,10 @@ class CSComboProcessor(ComboProcessor):
objlist = conn.GetAllObjects()
# if 'crm.claim' in objlist:
# list.append('CRM Claim')
if 'crm.helpdesk' in objlist:
list.append('CRM Helpdesk')
if 'crm.fundraising' in objlist:
list.append('CRM Fundraising')
# if 'crm.helpdesk' in objlist:
# list.append('CRM Helpdesk')
# if 'crm.fundraising' in objlist:
# list.append('CRM Fundraising')
if'hr.applicant' in objlist:
list.append('HR Applicant')
if'project.issue' in objlist:
View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

File diff suppressed because one or more lines are too long
+21 -18
View File
@@ -44,7 +44,7 @@ STYLE DS_SETFONT | WS_CHILD | WS_CAPTION | WS_SYSMENU
CAPTION "Connection Parameters"
FONT 8, "Tahoma", 0, 0, 0x1
BEGIN
GROUPBOX "",IDC_STATIC_GROUP, 10, 10,250,130
GROUPBOX "Connection Parameters",IDC_STATIC_GROUP, 10, 10,250,130
LTEXT "Server : ",IDC_STATIC,30,30,100,17
EDITTEXT ID_SERVER_PORT,85,30,120,12,ES_READONLY | WS_VISIBLE | WS_TABSTOP// left top width height
PUSHBUTTON "Change",IDC_BUT_SET_SERVER_PORT,210,30,30,13, WS_VISIBLE | WS_TABSTOP
@@ -71,17 +71,17 @@ EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Documents Setting"
FONT 8, "Tahoma", 0, 0, 0x1
BEGIN
GROUPBOX "Document Attributes",IDC_STATIC_GROUP, 2, 2, 340, 32
GROUPBOX "Document Attributes",IDC_STATIC_GROUP, 2, 2, 343, 32
LTEXT "Title",IDC_STATIC,6,15,30,17
EDITTEXT IDC_OBJECT_TITLE,20,14,57,12,ES_AUTOHSCROLL | WS_TABSTOP// left top width height
LTEXT "Document Name",IDC_STATIC,83,15,60,17
LTEXT "Title:",IDC_STATIC,5,16,30,17
EDITTEXT IDC_OBJECT_TITLE,22,14,57,12,ES_AUTOHSCROLL | WS_TABSTOP// left top width height
LTEXT "Document Name:",IDC_STATIC,83,16,60,17
EDITTEXT IDC_OBJECT_NAME,138,14,57,12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Image",IDC_STATIC,200,15,20,17
EDITTEXT IDC_IMAGE_PATH,220,14,57,12,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Load Image",IDC_BUT_LOAD_IMAGE,286,13,50,15,WS_TABSTOP
PUSHBUTTON "Add",IDC_BUT_SAVE_OBJECT,347,13,38,15,WS_TABSTOP
PUSHBUTTON "Remove",IDC_BUT_DEL_OBJECT,391,13,38,15,WS_TABSTOP
LTEXT "Image:",IDC_STATIC,200,16,22,17
EDITTEXT IDC_IMAGE_PATH,223,14,57,12,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Load Image",IDC_BUT_LOAD_IMAGE,289,13,50,15,WS_TABSTOP
PUSHBUTTON "Add",IDC_BUT_SAVE_OBJECT,350,13,38,15,WS_TABSTOP
PUSHBUTTON "Delete",IDC_BUT_DEL_OBJECT,392,13,38,15,WS_TABSTOP
CONTROL "List1",IDC_LIST,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
LVS_SHOWSELALWAYS | LVS_EX_GRIDLINES | LVS_REPORT | LVS_EX_FULLROWSELECT, 8,40,535,160
END
@@ -125,13 +125,13 @@ BEGIN
CONTROL "List1",IDC_NAME_LIST,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_SHOWSELALWAYS | LVS_REPORT | WS_TABSTOP, 15,150,234,110
PUSHBUTTON "Push",ID_MAKE_ATTACHMENT,160,270,85,14,WS_TABSTOP
GROUPBOX " Create a Document ", IDC_STATIC_GROUP, 263,5,202,100,WS_TABSTOP
GROUPBOX " Create a New Document ", IDC_STATIC_GROUP, 263,5,202,100,WS_TABSTOP
LTEXT "Type of Document : ",IDC_STATIC,266,25,100,12
COMBOBOX ID_ATT_METHOD_DROPDOWNLIST,332,24,75,45,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Create",ID_CREATE_CASE,412,23,50,14,WS_TABSTOP
GROUPBOX " Create a Contact ", IDC_STATIC_GROUP, 263, 110,202,185,WS_TABSTOP
GROUPBOX " Create a New Contact ", IDC_STATIC_GROUP, 263, 110,202,185,WS_TABSTOP
LTEXT "Create a New Contact : ",IDC_STATIC,280,140,100,12
PUSHBUTTON "Create Contact",ID_CREATE_CONTACT,360,138,60,14,WS_TABSTOP
PUSHBUTTON "Close",IDCANCEL,385,300,60,14,WS_TABSTOP
@@ -160,12 +160,15 @@ BEGIN
EDITTEXT ID_ZIP_TEXT,76, 93, 100, 12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "City : ",IDC_STATIC, 18,106, 50, 17
EDITTEXT ID_PARTNER_CITY_TEXT,76,107,100,12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Fed. State : ",IDC_STATIC,18,121,50,17
EDITTEXT IDET_NC_PARTNER_STATE, 76, 122, 54, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search", IDPB_NC_SEARCH_STATE1 ,135, 121, 40, 12, WS_TABSTOP
LTEXT "Country :",IDC_STATIC, 18, 134, 35, 17
EDITTEXT IDET_NC_PARTNER_COUNTRY, 76, 135, 54, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search", IDPB_NC_SEARCH_COUNTRY1, 135, 136, 40, 12, WS_TABSTOP
LTEXT "Fed. State : ",IDC_STATIC,18, 134, 50, 15
EDITTEXT IDET_NC_PARTNER_STATE, 76, 135, 54, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search", IDPB_NC_SEARCH_STATE1 ,135, 136, 40, 12, WS_TABSTOP
LTEXT "Country :",IDC_STATIC, 18,121,35,15
EDITTEXT IDET_NC_PARTNER_COUNTRY, 76, 122, 54, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search", IDPB_NC_SEARCH_COUNTRY1, 135, 121, 40, 12, WS_TABSTOP
GROUPBOX "Communication ", IDC_STATIC_GROUP, 188, 35, 150, 123

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

+1 -1
View File
@@ -94,4 +94,4 @@ def generateEML(mail):
if (success == False):
print cemail.lastErrorText()
sys.exit()
return new_mail
return new_mail
View File
+36 -11
View File
@@ -43,7 +43,7 @@ def execute(connector, method, *args):
if e.args[0] == 111:
if wait_count > wait_limit:
print "Server is taking too long to start, it has exceeded the maximum limit of %d seconds."%(wait_limit)
# clean() Commented...
clean()
sys.exit(1)
print 'Please wait %d sec to start server....'%(waittime)
wait_count += 1
@@ -232,7 +232,10 @@ class XMLRpcConn(object):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids=[]
obj_list=[]
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',[('name','ilike',ustr(search_partner))])
domain = []
if not search_partner.strip() == '':
domain.append(('name','ilike',ustr(search_partner)))
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',domain)
if ids:
ids.sort()
obj_list.append((-999, ustr('')))
@@ -349,14 +352,21 @@ class XMLRpcConn(object):
state = res['state_id']
country = res['country_id']
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
partner_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner', 'search', [('name','=',ustr(partner))])
res.update({'partner_id' : partner_id[0]})
if not partner.strip() == '':
partner_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner', 'search', [('name','=',ustr(partner))])
res.update({'partner_id' : partner_id[0]})
else:
res.pop('partner_id')
if not state == "":
country_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', [('name','=',ustr(country))])
res.update({'country_id' : country_id[0]})
else:
res.pop('country_id')
if not country == "":
state_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', [('name','=',ustr(state))])
res.update({'state_id' : state_id[0]})
else:
res.pop('state_id')
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner.address','create',res)
return id
@@ -440,13 +450,20 @@ class XMLRpcConn(object):
country_list.append((obj['id'], ustr(obj['name'])))
return country_list
def SearchPartner(self, partner = ""):
def SearchPartner(self, mail_id = ""):
import win32ui
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
partner_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner', 'search', [('name','=',ustr(partner))])
if not partner_id:
address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(mail_id))])
if not address:
return None
return partner_id[0]
else:
add_rec = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'read', address[0])
partner = add_rec.get('partner_id',False)
if partner:
return partner[0]
else:
return True
return partner_id[0]
def SearchEmailResources(self, message_id):
import win32ui
@@ -468,7 +485,10 @@ class XMLRpcConn(object):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids=[]
obj_list=[]
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country','search',[('name','ilike',ustr(country_search))])
domain = []
if not country_search.strip() == '':
domain.append(('name','ilike',ustr(country_search)))
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country','search',domain)
if ids:
ids.sort()
for id in ids:
@@ -483,11 +503,16 @@ class XMLRpcConn(object):
ids = []
c_id = []
obj_list = []
domain = []
if not state_search.strip() == '':
domain.append(('name','ilike',ustr(state_search)))
if country == None:
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',[('name','ilike',ustr(state_search))])
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',domain)
if not country == None:
c_id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country','search',[('name','=',ustr(country))])
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',[('name','ilike',ustr(state_search)),('country_id','=',c_id[0])])
domain.append(('country_id','=',c_id[0]))
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',domain)
if ids:
ids.sort()
for id in ids: