[IMP] Added New Features 1. Open Conatct 2.Web Server Configuration 3.Search Dialog for Partner in Open Contact and New Contact 4. Search Doialog for State and Country in Open Contact and New Contact

bzr revid: jam@tinyerp.com-20101006092731-650ecaivksgyr2ut
This commit is contained in:
Jigar Amin
2010-10-06 14:57:31 +05:30
parent 8d3866765e
commit dca6b9b258
22 changed files with 742 additions and 114 deletions
@@ -1,2 +1,2 @@
python addin.py
pause
pause
@@ -1,2 +1,2 @@
python addin.py --unregister
pause
python addin.py --unregister
pause
+73 -8
View File
@@ -61,14 +61,14 @@ def GetConn():
return d
class ButtonEvent:
def OnClick(self, button, cancel):
import win32ui
try:
mngr = manager.GetManager()
mngr.ShowManager()
except Exception,e:
win32ui.MessageBox("Fail to Initialize dialog.\n"+str(e),"OpenERP Configuration", win32con.MB_ICONERROR)
return cancel
def OnClick(self, button, cancel):
import win32ui
try:
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 OnClick(self, button, cancel):
@@ -89,6 +89,47 @@ class ViewPartners:
win32ui.MessageBox("Multiple selection not allowed. Please select only one mail at a time.","Open Contact",win32con.MB_ICONINFORMATION)
return cancel
#
class OpenPartner:
def OnClick(self, button, cancel):
import win32ui
from manager import ustr
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 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 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 OnClick(self, button, cancel):
from win32com.client import Dispatch
import win32con
import win32ui
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 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
#
class ArchiveEvent:
def OnClick(self, button, cancel):
from win32com.client import Dispatch
@@ -151,7 +192,22 @@ class OutlookAddin:
item.Enabled = True
# Adding Menu in Menu Bar to the Web Menu of the Outlook
toolbaradvance = bars.Item("Advanced")
toolbarweb = bars.Item("Web")
item = toolbarweb.Controls.Add(Type = constants.msoControlButton, Temporary = True)
item = self.toolbarButtonPOpenPartner = DispatchWithEvents(item, OpenPartner)
item.Caption = "Open Partners"
item.TooltipText = "Click to Open OpenERP Partner Contact Information."
item.Enabled = True
# item = toolbarweb.Controls.Add(Type = constants.msoControlButton, Temporary = True)
# item = self.toolbarButtonOpenDocument = DispatchWithEvents(item, OpenDocument)
# item.Caption = "Open Document"
# item.TooltipText = "Click to Open Document that ha 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)
@@ -159,6 +215,7 @@ class OutlookAddin:
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)
@@ -166,6 +223,14 @@ class OutlookAddin:
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_openpartner_Button = DispatchWithEvents(item, OpenPartner)
item.Caption = "Open Partner"
item.TooltipText = "Click to Open Partner detail"
item.Enabled = True
def OnDisconnection(self, mode, custom):
mngr = manager.GetManager()
mngr.config['login'] = False
+10 -1
View File
@@ -635,6 +635,8 @@ class CkSocket(_object):
def GetSslAcceptableClientCaDn(self, *args): return _chilkat.CkSocket_GetSslAcceptableClientCaDn(self, *args)
def getSslAcceptableClientCaDn(self, *args): return _chilkat.CkSocket_getSslAcceptableClientCaDn(self, *args)
def AddSslAcceptableClientCaDn(self, *args): return _chilkat.CkSocket_AddSslAcceptableClientCaDn(self, *args)
def get_ReceivedCount(self): return _chilkat.CkSocket_get_ReceivedCount(self)
def put_ReceivedCount(self, *args): return _chilkat.CkSocket_put_ReceivedCount(self, *args)
def UnlockComponent(self, *args): return _chilkat.CkSocket_UnlockComponent(self, *args)
def IsUnlocked(self): return _chilkat.CkSocket_IsUnlocked(self)
def AsyncSendBytes(self, *args): return _chilkat.CkSocket_AsyncSendBytes(self, *args)
@@ -2173,6 +2175,11 @@ class CkMailMan(_object):
def put_Pop3Stls(self, *args): return _chilkat.CkMailMan_put_Pop3Stls(self, *args)
def AddPfxSourceData(self, *args): return _chilkat.CkMailMan_AddPfxSourceData(self, *args)
def AddPfxSourceFile(self, *args): return _chilkat.CkMailMan_AddPfxSourceFile(self, *args)
def SmtpSendRawCommand(self, *args): return _chilkat.CkMailMan_SmtpSendRawCommand(self, *args)
def smtpSendRawCommand(self, *args): return _chilkat.CkMailMan_smtpSendRawCommand(self, *args)
def Pop3SendRawCommand(self, *args): return _chilkat.CkMailMan_Pop3SendRawCommand(self, *args)
def pop3SendRawCommand(self, *args): return _chilkat.CkMailMan_pop3SendRawCommand(self, *args)
def Pop3EndSessionNoQuit(self): return _chilkat.CkMailMan_Pop3EndSessionNoQuit(self)
def lastErrorText(self): return _chilkat.CkMailMan_lastErrorText(self)
def lastErrorXml(self): return _chilkat.CkMailMan_lastErrorXml(self)
def lastErrorHtml(self): return _chilkat.CkMailMan_lastErrorHtml(self)
@@ -3155,7 +3162,7 @@ class CkHttp(_object):
def put_UseBgThread(self, *args): return _chilkat.CkHttp_put_UseBgThread(self, *args)
def BgResponseObject(self): return _chilkat.CkHttp_BgResponseObject(self)
def BgTaskAbort(self): return _chilkat.CkHttp_BgTaskAbort(self)
def ClearEventLog(self): return _chilkat.CkHttp_ClearEventLog(self)
def ClearBgEventLog(self): return _chilkat.CkHttp_ClearBgEventLog(self)
def EventLogName(self, *args): return _chilkat.CkHttp_EventLogName(self, *args)
def eventLogName(self, *args): return _chilkat.CkHttp_eventLogName(self, *args)
def EventLogValue(self, *args): return _chilkat.CkHttp_EventLogValue(self, *args)
@@ -3759,6 +3766,8 @@ class CkSpider(_object):
def put_ProxyPassword(self, *args): return _chilkat.CkSpider_put_ProxyPassword(self, *args)
def get_ProxyPort(self): return _chilkat.CkSpider_get_ProxyPort(self)
def put_ProxyPort(self, *args): return _chilkat.CkSpider_put_ProxyPort(self, *args)
def get_VerboseLogging(self): return _chilkat.CkSpider_get_VerboseLogging(self)
def put_VerboseLogging(self, *args): return _chilkat.CkSpider_put_VerboseLogging(self, *args)
def put_UserAgent(self, *args): return _chilkat.CkSpider_put_UserAgent(self, *args)
def userAgent(self): return _chilkat.CkSpider_userAgent(self)
def get_UserAgent(self, *args): return _chilkat.CkSpider_get_UserAgent(self, *args)
View File
+426 -78
View File
@@ -31,7 +31,7 @@ import addin
from dialogs import ShowDialog, MakePropertyPage
import win32ui
import webbrowser
import commctrl
import win32con
import win32gui
@@ -168,6 +168,19 @@ global name
name=''
global email
email=''
global web_server
web_server = 'localhost'
global web_server_port
web_server_port = '8080'
global country_ref
country_ref = ""
global state_ref
state_ref = ""
global new_con_country
new_con_country= ""
global new_con_state
new_con_state= ""
def check():
server = NewConn.getitem('_server')
@@ -251,7 +264,6 @@ class OKButtonProcessor(ButtonProcessor):
try:
port = int(win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[1]))
except ValueError, e:
print "Exception : %s"%str(e)
win32ui.MessageBox("Port should be an integer", "OpenERP Connection", flag_excl)
return
except Exception,e:
@@ -277,6 +289,27 @@ class DoneButtonProcessor(ButtonProcessor):
self.window.manager.SaveConfig()
win32gui.EndDialog(self.window.hwnd, id)
class WEBOKButtonProcessor(ButtonProcessor):
def __init__(self, window, control_ids):
self.mngr = window.manager
ControlProcessor.__init__(self, window, control_ids)
def OnClicked(self, id):
global web_server
global web_server_port
server = win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[0])
try:
port = int(win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[1]))
except ValueError, e:
win32ui.MessageBox("Port should be an integer", "OpenERP Connection", flag_excl)
return
if server.strip() == "" or server.strip() == "http:\\\\":
win32ui.MessageBox("Invalid web Server address.", "OpenERP Connection", flag_excl)
return
web_server = server
web_server_port = port
win32gui.EndDialog(self.window.hwnd, id)
class MessageProcessor(ControlProcessor):
def Init(self):
text = " This Outlook Plugin for OpenERP has been developed by OpenERP s.a.\n\n \
@@ -784,6 +817,8 @@ def CreateContact(btnProcessor,*args):
street2 = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[6])
city = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7])
zip = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8])
state = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[10])
country = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
if not name:
win32ui.MessageBox("Please enter name.", "Create Contact", flag_stop)
return
@@ -798,9 +833,10 @@ def CreateContact(btnProcessor,*args):
'street':ustr(street),
'street2':ustr(street2),
'city':ustr(city),
'zip':ustr(zip)
'zip':ustr(zip),
'state_id':ustr(state),
'country_id':ustr(country)
}
try:
id = NewConn.CreateContact(str(res))
if not partner:
@@ -818,6 +854,10 @@ def CreateContact(btnProcessor,*args):
def SetAllText(txtProcessor,*args):
# Set values for url, uname, pwd from config file
global web_server
global web_server_port
serverBox = txtProcessor.GetControl(txtProcessor.other_ids[2])
win32gui.SendMessage(serverBox, win32con.WM_SETTEXT, 0, "http:\\\\"+str(web_server)+":"+str(web_server_port))
url = NewConn.getitem('_uri')
tbox = txtProcessor.GetControl()
win32gui.SendMessage(tbox, win32con.WM_SETTEXT, 0, str(url))
@@ -893,10 +933,22 @@ def SetDefaultContact(txtProcessor,*args):
global name
global email
global partner_ref
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[1],partner_ref)
global new_con_country
global new_con_state
state = win32gui.GetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[3])
country = win32gui.GetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[2])
if txtProcessor.init_done:
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[1],partner_ref)
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.control_id,name)
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0],email)
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[2],new_con_state)
state_val = NewConn.FindCountryForState(str(state_ref))
if state_val == None:
new_con_country = country
new_con_country = state_val
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[3],new_con_country)
new_con_country = ""
new_con_state = ""
return
#
try:
@@ -978,7 +1030,7 @@ def CreatePartner(btnProcessor,*args):
b = check()
if not b:
return
global partner_ref
partner_name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
if not partner_name:
win32ui.MessageBox("Please enter Partner name.", "Create Partner", flag_excl)
@@ -992,6 +1044,7 @@ def CreatePartner(btnProcessor,*args):
return
if id:
win32ui.MessageBox("New Partner '%s' created."%partner_name, "Create Partner", flag_info)
partner_ref = str(partner_name)
win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.id)
else:
win32ui.MessageBox("Partner '%s' already Exists."%partner_name, "Create Partner", flag_info)
@@ -1016,7 +1069,29 @@ def GetDefaultEmail(txtProcessor,*args):
import win32con
b = check()
global partner_ref
global country_ref
global state_ref
partner_n = win32gui.GetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0])
state_n = win32gui.GetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[10])
country_n = win32gui.GetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[11])
if partner_ref == "":
partner_ref = partner_n
if country_ref == "":
country_ref = country_n
if state_ref == "":
state_ref = state_n
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0], ustr(partner_ref))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[10], ustr(state_ref))
state_val = NewConn.FindCountryForState(str(state_ref))
partner_ref = ""
country_ref = ""
state_ref = ""
if state_val == None:
country_ref = country_n
country_ref = state_val
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[11], ustr(country_ref))
if not b:
return
#Acquiring control of the text box
@@ -1167,6 +1242,8 @@ def WritePartner(btnProcessor,*args):
street = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
street2 = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3])
city = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[4])
state = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[5])
country = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[6])
phone = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7])
mobile = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8])
fax = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
@@ -1185,6 +1262,9 @@ def WritePartner(btnProcessor,*args):
new_vals.append(['email',email])
new_vals.append(['fax',fax])
new_vals.append(['zip',zip])
new_vals.append(['state',state])
new_vals.append(['country',country])
new_vals.append(['state',state])
flag = 0
try:
#writing the updated values to the Server.
@@ -1198,7 +1278,7 @@ def WritePartner(btnProcessor,*args):
elif flag == 0:
win32ui.MessageBox("Error in Updating the Changes.\n Please check the Database Connection.", "Open Contact", flag_error)
elif flag == -1:
win32ui.MessageBox("Contact can not be Save.\nFirst select contact using Search.","Open Contact", flag_info)
win32ui.MessageBox("Contact can not be Save.\nFirst select partner using Search.","Open Contact", flag_info)
def SetPartnerNameColumn(listProcessor,*args):
hwndList = listProcessor.GetControl()
@@ -1235,7 +1315,7 @@ def SelectPartnerFromList(btnProcessor,*args):
sel_text = nombre[0:size]
global partner_ref
if str(sel_text).strip() == "":
win32ui.MessageBox("Invalid Partner Selected.","Search Partner")
win32ui.MessageBox("Invalid partner selected.","Search Partner")
return
try:
partner_ref = str(sel_text)
@@ -1244,10 +1324,10 @@ def SelectPartnerFromList(btnProcessor,*args):
win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
return
elif sel_count < 1:
win32ui.MessageBox("You should Select atleast one partner.","Search Partner")
win32ui.MessageBox("You should select one partner.","Search Partner")
return
else:
win32ui.MessageBox("Multiple Selection is not allowded.","Search Partner")
win32ui.MessageBox("Multiple Selection is not allowed.","Search Partner")
return
def SearchPartnerList(btnProcessor,*args):
@@ -1275,82 +1355,350 @@ def SearchPartnerList(btnProcessor,*args):
win32ui.MessageBox(msg, "Search Partner", flag_error)
pass
def ConnectWebServer(btnProcessor, *args):
b = check()
if not b:
return
server = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
webbrowser.open_new(str(server)+"\\openerp\\")
def OpenPartnerForm(txtProcessor,*args):
from win32com.client import Dispatch
import win32con
b = check()
if not b:
return
#Acquiring control of the text box
partner_link = txtProcessor.GetControl()
#Reading Current Selected Email.
ex = txtProcessor.window.manager.outlook.ActiveExplorer()
assert ex.Selection.Count == 1
mail = ex.Selection.Item(1)
partner_text = ""
try:
partner_text = ustr(mail.SenderName).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)
if vals == None:
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, "< No Partner with named "+str(partner_text)+" found.>")
txtProcessor.init_done=True
return
global web_server
global web_server_port
if web_server.strip() == "" or web_server.strip() == "http:\\\\":
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, " <Invalid Server Address>")
txtProcessor.init_done=True
return
try:
linktopartner = "http:\\\\"+web_server+":"+str(web_server_port)+"\\openerp\\form\\view?model=res.partner&id="+str(vals)
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, linktopartner)
except Exception,e:
win32ui.MessageBox("Error While Opening Partner.\n"+str(e),"Open Partner", flag_error)
webbrowser.open_new(linktopartner)
txtProcessor.init_done=True
def SerachOpenDocuemnt(txtProcessor,*args):
from win32com.client import Dispatch
import win32con
b = check()
if not b:
return
global web_server
global web_server_port
#Acquiring control of the text box
link_box = txtProcessor.GetControl()
if web_server.strip() == "" or web_server.strip() == "http:\\\\":
win32gui.SendMessage(link_box, win32con.WM_SETTEXT, 0, " <Invalid Server Address>")
txtProcessor.init_done=True
return
linktodoc = ""
#Reading Current Selected Email.
vals = []
ex = txtProcessor.window.manager.outlook.ActiveExplorer()
assert ex.Selection.Count == 1
mail = ex.Selection.Item(1)
e_id = ustr(mail.EntryID).encode('iso-8859-1')
vals = list(NewConn.SearchEmailResources(mail))
if vals == None:
win32gui.SendMessage(link_box, win32con.WM_SETTEXT, 0, "< Mail is still not archived.>")
txtProcessor.init_done=True
return
try:
linktodoc = web_server+":"+str(web_server_port)+"\\openerp\\form\\view?model="+vals[0][1]+"&id="+str(vals[1][1])
win32gui.SendMessage(link_box, win32con.WM_SETTEXT, 0, linktodoc)
except Exception,e:
win32ui.MessageBox("Error While Opening Document.\n"+str(e),"Open Document", flag_error)
webbrowser.open_new(linktodoc)
txtProcessor.init_done=True
def SearchCountry(btnProcessor, *args):
b = check()
if not b:
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))
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())
except Exception,e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Search Country", flag_error)
pass
def SetCountryList(listProcessor,*args):
hwndList = listProcessor.GetControl()
child_ex_style = win32gui.SendMessage(hwndList, commctrl.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
child_ex_style |= commctrl.LVS_EX_FULLROWSELECT
win32gui.SendMessage(hwndList, commctrl.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, child_ex_style)
# set header row
lvc = LVCOLUMN(
mask = commctrl.LVCF_FMT | commctrl.LVCF_WIDTH | \
commctrl.LVCF_TEXT | commctrl.LVCF_SUBITEM
)
lvc.fmt = commctrl.LVCFMT_LEFT
lvc.iSubItem = 1
lvc.text = "Country Name"
lvc.cx = 275
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
listProcessor.init_done = True
def SelectCountryFromList(btnProcessor,*args):
hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
sel_count = win32gui.SendMessage(hwndList, commctrl.LVM_GETSELECTEDCOUNT)
sel_text = ''
if sel_count == 1:
sel=-1
for i in range(0,sel_count):
sel = win32gui.SendMessage(hwndList, commctrl.LVM_GETNEXTITEM, sel, commctrl.LVNI_SELECTED)
buf,extra = win32gui_struct.EmptyLVITEM(1, 0)
size = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMTEXT, sel, buf)
sel_text = ''
for n in extra:
nombre = n.tostring()
sel_text = nombre[0:size]
global country_ref
global new_con_country
if str(sel_text).strip() == "":
win32ui.MessageBox("Invalid country selected.","Search Country")
return
try:
country_ref = str(sel_text)
new_con_country = str(sel_text)
except Exception,e:
pass
win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
return
elif sel_count < 1:
win32ui.MessageBox("You must one country.","Search Country")
return
else:
win32ui.MessageBox("Multiple selection is not allowed.","Search Country")
return
def SearchState(btnProcessor, *args):
b = check()
if not b:
return
try :
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))
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())
except Exception,e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Search Fed.State", flag_error)
pass
def SetStateList(listProcessor,*args):
hwndList = listProcessor.GetControl()
child_ex_style = win32gui.SendMessage(hwndList, commctrl.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
child_ex_style |= commctrl.LVS_EX_FULLROWSELECT
win32gui.SendMessage(hwndList, commctrl.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, child_ex_style)
# set header row
lvc = LVCOLUMN(
mask = commctrl.LVCF_FMT | commctrl.LVCF_WIDTH | \
commctrl.LVCF_TEXT | commctrl.LVCF_SUBITEM
)
lvc.fmt = commctrl.LVCFMT_LEFT
lvc.iSubItem = 1
lvc.text = "Fed.State Name"
lvc.cx = 275
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
listProcessor.init_done = True
def SelectStateFromList(btnProcessor,*args):
hwndList = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
sel_count = win32gui.SendMessage(hwndList, commctrl.LVM_GETSELECTEDCOUNT)
sel_text = ''
if sel_count == 1:
sel=-1
for i in range(0,sel_count):
sel = win32gui.SendMessage(hwndList, commctrl.LVM_GETNEXTITEM, sel, commctrl.LVNI_SELECTED)
buf,extra = win32gui_struct.EmptyLVITEM(1, 0)
size = win32gui.SendMessage(hwndList, commctrl.LVM_GETITEMTEXT, sel, buf)
sel_text = ''
for n in extra:
nombre = n.tostring()
sel_text = nombre[0:size]
global state_ref
global new_con_state
if str(sel_text).strip() == "":
win32ui.MessageBox("Invalid fed. state selected.","Search Fed.State")
return
try:
state_ref = str(sel_text)
new_con_state = str(sel_text)
win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
except Exception,e:
pass
return
elif sel_count < 1:
win32ui.MessageBox("You must select state.","Search Fed.State")
return
else:
win32ui.MessageBox("Multiple selection is not allowed.","Search Fed.State")
return
dialog_map = {
"IDD_MANAGER" : (
(CancelButtonProcessor, "IDCANCEL", resetConnAttribs, ()),
(TabProcessor, "IDC_TAB IDC_LIST",
"""IDD_GENERAL IDD_OBJECT_SETTINGS IDD_ABOUT"""),
(DoneButtonProcessor, "ID_DONE"),
),
"IDD_MANAGER" : (
(CancelButtonProcessor, "IDCANCEL", resetConnAttribs, ()),
(TabProcessor, "IDC_TAB IDC_LIST",
"""IDD_GENERAL IDD_OBJECT_SETTINGS IDD_ABOUT"""),
(DoneButtonProcessor, "ID_DONE"),
),
"IDD_GENERAL": (
(DBComboProcessor, "ID_DB_DROPDOWNLIST", GetConn, ()),
(TextProcessor, "ID_SERVER_PORT ID_USERNAME ID_PASSWORD", SetAllText, ()),
(CommandButtonProcessor, "ID_BUT_TESTCONNECTION ID_DB_DROPDOWNLIST ID_USERNAME \
ID_PASSWORD", TestConnection, ()),
(CommandButtonProcessor, "IDC_RELOAD", ReloadAllControls, ()),
(DialogCommand, "IDC_BUT_SET_SERVER_PORT", "IDD_SERVER_PORT_DIALOG"),
),
"IDD_GENERAL": (
(DBComboProcessor, "ID_DB_DROPDOWNLIST", GetConn, ()),
(TextProcessor, "ID_SERVER_PORT ID_USERNAME ID_PASSWORD IDET_WED_SERVER", SetAllText, ()),
(CommandButtonProcessor, "ID_BUT_TESTCONNECTION ID_DB_DROPDOWNLIST ID_USERNAME \
ID_PASSWORD", TestConnection, ()),
(CommandButtonProcessor, "IDC_RELOAD", ReloadAllControls, ()),
(DialogCommand, "IDC_BUT_SET_SERVER_PORT", "IDD_SERVER_PORT_DIALOG"),
(DialogCommand, "ID_SET_WEB_CONNECTION", "IDD_WEB_SERVER_PORT_DIALOG" ),
(CommandButtonProcessor, "IDPB_WEB_CONNECTION IDET_WED_SERVER", ConnectWebServer, ()),
),
"IDD_OBJECT_SETTINGS" : (
(CommandButtonProcessor, "IDC_BUT_LOAD_IMAGE IDC_IMAGE_PATH", GetImagePath, ()),
(CommandButtonProcessor, "IDC_BUT_SAVE_OBJECT IDC_OBJECT_TITLE IDC_OBJECT_NAME \
IDC_IMAGE_PATH IDC_LIST", AddNewObject, ()),
(CommandButtonProcessor, "IDC_BUT_DEL_OBJECT IDC_LIST", DeleteSelectedObjects, ()),
(ListBoxProcessor, "IDC_LIST", SetDefaultList, ())
),
"IDD_OBJECT_SETTINGS" : (
(CommandButtonProcessor, "IDC_BUT_LOAD_IMAGE IDC_IMAGE_PATH", GetImagePath, ()),
(CommandButtonProcessor, "IDC_BUT_SAVE_OBJECT IDC_OBJECT_TITLE IDC_OBJECT_NAME \
IDC_IMAGE_PATH IDC_LIST", AddNewObject, ()),
(CommandButtonProcessor, "IDC_BUT_DEL_OBJECT IDC_LIST", DeleteSelectedObjects, ()),
(ListBoxProcessor, "IDC_LIST", SetDefaultList, ())
),
"IDD_ABOUT" : (
(ImageProcessor, "IDB_OPENERPLOGO"),
(MessageProcessor, "IDC_ABOUT"),
),
"IDD_ABOUT" : (
(ImageProcessor, "IDB_OPENERPLOGO"),
(MessageProcessor, "IDC_ABOUT"),
),
"IDD_SERVER_PORT_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(OKButtonProcessor, "IDOK ID_SERVER ID_PORT IDR_XML_PROTOCOL"),
(RadioButtonProcessor, "IDR_XML_PROTOCOL", GetConn, ()),
(RadioButtonProcessor, "IDR_XMLS_PROTOCOL", GetConn, ()),
(RadioButtonProcessor, "IDR_NETRPC_PROTOCOL", GetConn, ()),
),
"IDD_SERVER_PORT_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(OKButtonProcessor, "IDOK ID_SERVER ID_PORT IDR_XML_PROTOCOL"),
# (RadioButtonProcessor, "IDR_XML_PROTOCOL", GetConn, ()),
# (RadioButtonProcessor, "IDR_XMLS_PROTOCOL", GetConn, ()),
# (RadioButtonProcessor, "IDR_NETRPC_PROTOCOL", GetConn, ()),
),
"IDD_SYNC" : (
(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", CreateCase, ()),
(ListBoxProcessor, "IDC_NAME_LIST", SetNameColumn, ())
),
"IDD_SYNC" : (
(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", CreateCase, ()),
(ListBoxProcessor, "IDC_NAME_LIST", SetNameColumn, ())
),
"IDD_NEW_CONTACT_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(CommandButtonProcessor, "ID_CONTACT_SAVE_BUTTON ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_CONTACT_OFFICE_TEXT ID_CONTACT_MOBILE_TEXT ID_FAX_TEXT ID_STREET_TEXT ID_STREET2_TEXT ID_PARTNER_CITY_TEXT ID_ZIP_TEXT ID_PARTNER_TEXT", CreateContact, ()),
(TextProcessor, "ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_PARTNER_TEXT" , SetDefaultContact, ()),
(DialogCommand, "ID_NEW_PARTNER_BUTTON", "IDD_SELECT_PARTNER"),
),
"IDD_NEW_CONTACT_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(CommandButtonProcessor, "ID_CONTACT_SAVE_BUTTON ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_CONTACT_OFFICE_TEXT ID_CONTACT_MOBILE_TEXT ID_FAX_TEXT ID_STREET_TEXT ID_STREET2_TEXT ID_PARTNER_CITY_TEXT ID_ZIP_TEXT ID_PARTNER_TEXT IDET_NC_PARTNER_STATE IDET_NC_PARTNER_COUNTRY", CreateContact, ()),
(TextProcessor, "ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_PARTNER_TEXT IDET_NC_PARTNER_STATE IDET_NC_PARTNER_COUNTRY" , SetDefaultContact, ()),
(DialogCommand, "ID_NEW_PARTNER_BUTTON", "IDD_SELECT_PARTNER"),
(DialogCommand, "IDPB_NEW_PARTNER_BUTTON", "IDD_NEW_PARTNER_DIALOG"),
(DialogCommand, "IDPB_NC_SEARCH_STATE1", "IDD_SELECT_STATE"),
(DialogCommand, "IDPB_NC_SEARCH_COUNTRY1", "IDD_SELECT_COUNTRY"),
),
"IDD_NEW_PARTNER_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(CommandButtonProcessor, "ID_SAVE_PARTNER_BUTTON ID_PARTNER_NAME_TEXT", CreatePartner, ()),
),
"IDD_NEW_PARTNER_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(CommandButtonProcessor, "ID_SAVE_PARTNER_BUTTON ID_PARTNER_NAME_TEXT", CreatePartner, ()),
),
"IDD_VIEW_PARTNER_DIALOG" : (
(TextProcessor, "IDET_SEARCH_PARTNER IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP IDET_PARTNER_STATE IDET_PARTNER_COUNTRY", GetDefaultEmail, ()),
(CommandButtonProcessor, "IDPB_SEARCH_PARTNER IDET_SEARCH_PARTNER IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP IDET_PARTNER_STATE IDET_PARTNER_COUNTRY", SearchPartner, ()),
(CommandButtonProcessor, "IDPB_WRITE_CHANGES IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_STATE IDET_PARTNER_COUNTRY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP", WritePartner, ()),
(CloseButtonProcessor, "IDCANCEL"),
(DialogCommand, "ID_NEW_PART_BUTTON", "IDD_SELECT_PARTNER" ),
(DialogCommand, "IDPB_NEWPARTNER_BUTTON" , "IDD_NEW_CONTACT_DIALOG")
),
"IDD_SELECT_PARTNER" : (
(CloseButtonProcessor, "IDCANCEL"),
(ListBoxProcessor, "IDC_LIST_PARTNER" ,SetPartnerNameColumn, ()),
(CommandButtonProcessor, "IDPB_PARTNER_SEARCH IDET_PARTNER_SEARCH_NAME IDC_LIST_PARTNER", SearchPartnerList,()),
(CommandButtonProcessor, "IDPB_SELECT_PARTNER IDC_LIST_PARTNER IDD_SELECT_PARTNER" , SelectPartnerFromList,()),
(DialogCommand, "IDPB_CREATE_NEW_PARTNER" , "IDD_NEW_PARTNER_DIALOG")
),
"IDD_VIEW_PARTNER_DIALOG" : (
(TextProcessor, "IDET_SEARCH_PARTNER IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP IDET_PARTNER_STATE IDET_PARTNER_COUNTRY", GetDefaultEmail, ()),
(CommandButtonProcessor, "IDPB_SEARCH_PARTNER IDET_SEARCH_PARTNER IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP IDET_PARTNER_STATE IDET_PARTNER_COUNTRY", SearchPartner, ()),
(CommandButtonProcessor, "IDPB_WRITE_CHANGES IDET_PARTNER IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY IDET_PARTNER_STATE IDET_PARTNER_COUNTRY IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP", WritePartner, ()),
(CloseButtonProcessor, "IDCANCEL"),
(DialogCommand, "ID_NEW_PART_BUTTON", "IDD_SELECT_PARTNER" ),
(DialogCommand, "IDPB_NEWPARTNER_BUTTON" , "IDD_NEW_CONTACT_DIALOG"),
(DialogCommand, "IDPB_NEW_PART_BUTTON", "IDD_NEW_PARTNER_DIALOG"),
(DialogCommand, "IDPB_SEARCH_COUNTRY1", "IDD_SELECT_COUNTRY"),
(DialogCommand, "IDPB_SEARCH_STATE1", "IDD_SELECT_STATE"),
),
"IDD_SELECT_PARTNER" : (
(ListBoxProcessor, "IDC_LIST_PARTNER" ,SetPartnerNameColumn, ()),
(CommandButtonProcessor, "IDPB_PARTNER_SEARCH IDET_PARTNER_SEARCH_NAME IDC_LIST_PARTNER", SearchPartnerList,()),
(CommandButtonProcessor, "IDPB_SELECT_PARTNER IDC_LIST_PARTNER IDD_SELECT_PARTNER" , SelectPartnerFromList,()),
(DialogCommand, "IDPB_CREATE_NEW_PARTNER" , "IDD_NEW_PARTNER_DIALOG")
),
"IDD_OPEN_PARTNER_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(TextProcessor, "IDET_PARTNER_LINK_TEXT", OpenPartnerForm, ()),
),
"IDD_OPEN_DOCUEMNT_DIALOG" : (
(CloseButtonProcessor, "IDCANCEL"),
(TextProcessor, "IDEB_OPENDOC_LINK_TEXT", SerachOpenDocuemnt,()),
),
"IDD_WEB_SERVER_PORT_DIALOG" :(
(CloseButtonProcessor, "IDCANCEL"),
(WEBOKButtonProcessor, "ID_WEB_OK IDET_WEB_SERVER IDET_WEB_PORT")
),
"IDD_SELECT_COUNTRY" : (
(CommandButtonProcessor, "IDPB_SEARCH_COUNTRY IDET_COUNTRY_SEARCH_NAME IDC_LIST_COUNTRY" , SearchCountry, ()),
(ListBoxProcessor, "IDC_LIST_COUNTRY" ,SetCountryList, ()),
(CommandButtonProcessor, "IDPB_SELECT_COUNTRY IDC_LIST_COUNTRY IDD_SELECT_COUNTRY" , SelectCountryFromList,()),
),
"IDD_SELECT_STATE" : (
(CommandButtonProcessor, "IDPB_STATE_SEARCH IDET_STATE_SEARCH_NAME IDC_LIST_STATE" , SearchState, ()),
(ListBoxProcessor, "IDC_LIST_STATE" ,SetStateList, ()),
(CommandButtonProcessor, "IDPB_SELECT_STATE IDC_LIST_STATE IDD_SELECT_STATE" , SelectStateFromList,()),
),
}
View File
View File
View File
View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

+31
View File
@@ -177,6 +177,37 @@
#define IDPB_PARTNER_SEARCH 2077
#define IDPB_CREATE_NEW_PARTNER 2078
#define ID_PARTNER_TEXT 2079
#define IDET_WED_SERVER 2080
#define IDET_WEB_PORT 2081
#define ID_SET_WEB_CONNECTION 2082
#define IDPB_WEB_CONNECTION 2083
#define IDD_OPEN_PARTNER_DIALOG 2084
#define IDET_PARTNER_LINK_TEXT 2085
#define IDEB_OPENDOC_LINK_TEXT 2086
#define IDD_OPEN_DOCUEMNT_DIALOG 2087
#define IDD_WEB_SERVER_PORT_DIALOG 2088
#define IDET_WEB_SERVER 2089
#define IDET_WEB_PORT 2090
#define ID_WEB_OK 2091
#define IDPB_NEW_PARTNER_BUTTON 2092
#define IDPB_NEW_PART_BUTTON 2093
#define IDD_SELECT_COUNTRY 2094
#define IDET_COUNTRY_SEARCH_NAME 2095
#define IDC_LIST_COUNTRY 2096
#define IDPB_SELECT_COUNTRY 2097
#define IDPB_SEARCH_COUNTRY 2098
#define IDD_SELECT_STATE 2099
#define IDET_STATE_SEARCH_NAME 2100
#define IDC_LIST_STATE 2101
#define IDPB_SELECT_STATE 2102
#define IDPB_SEARCH_STATE 2103
#define IDPB_SEARCH_STATE1 2104
#define IDPB_SEARCH_COUNTRY1 2105
#define IDET_NC_PARTNER_STATE 2106
#define IDPB_NC_SEARCH_STATE1 2107
#define IDET_NC_PARTNER_COUNTRY 2108
#define IDPB_NC_SEARCH_COUNTRY1 2109
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
File diff suppressed because one or more lines are too long
+99 -13
View File
@@ -57,6 +57,12 @@ BEGIN
LTEXT "Password : ",IDC_STATIC,30,90,100,17
EDITTEXT ID_PASSWORD,85,90,154,12,ES_AUTOHSCROLL | WS_VISIBLE | WS_TABSTOP | ES_PASSWORD
PUSHBUTTON "Connect",ID_BUT_TESTCONNECTION,179,110,60,13, WS_VISIBLE | WS_TABSTOP
GROUPBOX "WebServer Parameters",IDC_STATIC_GROUP, 270, 10,150,130
LTEXT "Server : ",IDC_STATIC, 280, 30, 50, 15
EDITTEXT IDET_WED_SERVER,310, 29, 90, 12,ES_AUTOHSCROLL | ES_READONLY
PUSHBUTTON "Change",ID_SET_WEB_CONNECTION, 295, 50, 50, 12 , WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "Connect",IDPB_WEB_CONNECTION, 350, 50, 50, 12 , WS_VISIBLE | WS_TABSTOP
END
IDD_OBJECT_SETTINGS DIALOGEX 0, 0, 430, 210
@@ -131,7 +137,7 @@ BEGIN
PUSHBUTTON "Close",IDCANCEL,385,300,60,14,WS_TABSTOP
END
IDD_NEW_CONTACT_DIALOG DIALOGEX 0, 0, 350, 150
IDD_NEW_CONTACT_DIALOG DIALOGEX 0, 0, 350, 180
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Create a New Contact"
@@ -139,10 +145,11 @@ FONT 8, "Tahoma", 1000, 0, 0x0
BEGIN
LTEXT "Select Partner : ",IDC_STATIC,13,20,50,17
EDITTEXT ID_PARTNER_TEXT, 70, 18, 200, 12 , ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search Partner",ID_NEW_PARTNER_BUTTON,280,17,60,14, WS_TABSTOP
EDITTEXT ID_PARTNER_TEXT, 70, 18, 150, 12 , ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search Partner",ID_NEW_PARTNER_BUTTON,225,17,60,14, WS_TABSTOP
PUSHBUTTON "New Partner",IDPB_NEW_PARTNER_BUTTON,290, 17, 50, 14, WS_TABSTOP
GROUPBOX "Postal Address ", IDC_STATIC_GROUP,10,35,175,90
GROUPBOX "Postal Address ", IDC_STATIC_GROUP,10,35,175,123
LTEXT "Contact Name : ",IDC_STATIC, 18, 53, 100, 17
EDITTEXT ID_CONTACT_NAME_TEXT, 76, 52, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Street : ",IDC_STATIC, 18, 67, 40, 17
@@ -153,9 +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
GROUPBOX "Communication ", IDC_STATIC_GROUP, 188, 35, 150, 90
GROUPBOX "Communication ", IDC_STATIC_GROUP, 188, 35, 150, 123
LTEXT "Office : ",IDC_STATIC,194, 53, 30, 17
EDITTEXT ID_CONTACT_OFFICE_TEXT, 224, 52, 100, 12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Mobile : ",IDC_STATIC,194, 67, 30, 17
@@ -165,8 +178,8 @@ BEGIN
LTEXT "Email : ",IDC_STATIC, 194, 95, 30, 17
EDITTEXT ID_CONTACT_EMAIL_TEXT, 224, 94, 100, 12,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Cancel",IDCANCEL,290,130,45,14, WS_TABSTOP
PUSHBUTTON "Save",ID_CONTACT_SAVE_BUTTON,240,130,45,14, WS_TABSTOP
PUSHBUTTON "Cancel",IDCANCEL,290,162,45,13, WS_TABSTOP
PUSHBUTTON "Save",ID_CONTACT_SAVE_BUTTON,240,162,45,13, WS_TABSTOP
END
IDD_NEW_PARTNER_DIALOG DIALOGEX 0, 0, 140,40
@@ -192,8 +205,9 @@ BEGIN
PUSHBUTTON "Search Contact ",IDPB_SEARCH_PARTNER,280,15,60,14,WS_TABSTOP
LTEXT "Partner Name : ",IDC_STATIC,13,42,50,17
EDITTEXT IDET_PARTNER,70, 42, 200, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search Partner",ID_NEW_PART_BUTTON,280,41,60,14, WS_TABSTOP
EDITTEXT IDET_PARTNER,70, 42, 150, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search Partner",ID_NEW_PART_BUTTON,225,41,60,14, WS_TABSTOP
PUSHBUTTON "New Partner",IDPB_NEW_PART_BUTTON,290,41,50,14, WS_TABSTOP
GROUPBOX "Postal Address ", IDC_STATIC_GROUP,10,65,175,125
LTEXT "Contact Name : ",IDC_STATIC,18,83,50,17
@@ -206,10 +220,14 @@ BEGIN
EDITTEXT IDET_ZIP, 76, 125, 100, 12 , ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "City : ",IDC_STATIC,18,140,50,17
EDITTEXT IDET_PARTNER_CITY,76,139,100,12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Fed. State : ",IDC_STATIC,18,154,50,17
EDITTEXT IDET_PARTNER_STATE, 76, 153, 100, 12,ES_AUTOHSCROLL |ES_READONLY
EDITTEXT IDET_PARTNER_STATE, 76, 153, 54, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search", IDPB_SEARCH_STATE1 ,135, 153, 40, 12, WS_TABSTOP
LTEXT "Country :",IDC_STATIC, 18, 169, 35, 17
EDITTEXT IDET_PARTNER_COUNTRY, 76, 168, 100, 12,ES_AUTOHSCROLL |ES_READONLY
EDITTEXT IDET_PARTNER_COUNTRY, 76, 168, 54, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search", IDPB_SEARCH_COUNTRY1, 135, 168, 40, 12, WS_TABSTOP
GROUPBOX "Communication ", IDC_STATIC_GROUP, 188, 65, 152, 125
LTEXT "Phone : ",IDC_STATIC, 194, 83, 30, 17
@@ -240,7 +258,75 @@ BEGIN
CONTROL "List1",IDC_LIST_PARTNER,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
LVS_SHOWSELALWAYS | LVS_EX_GRIDLINES | LVS_REPORT | LVS_EX_FULLROWSELECT, 8,40,200,185
PUSHBUTTON "Create New Partner", IDPB_CREATE_NEW_PARTNER, 10, 230, 100, 14, WS_TABSTOP
PUSHBUTTON "Select", IDPB_SELECT_PARTNER, 130, 230, 40, 14, WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 175, 230, 40, 14, WS_TABSTOP
PUSHBUTTON "Select", IDPB_SELECT_PARTNER, 170, 230, 40, 14, WS_TABSTOP
END
IDD_OPEN_PARTNER_DIALOG DIALOGEX 0, 0, 200,65
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Open Partner"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Link to Partner : (If this link does not opens directly in web browser then copy an the link and paste in web browser.) ",IDC_STATIC,5,3,190,25
EDITTEXT IDET_PARTNER_LINK_TEXT,5,31,190,12,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Ok",IDCANCEL,150,45,45,13,WS_TABSTOP
END
IDD_OPEN_DOCUEMNT_DIALOG DIALOGEX 0, 0, 200,65
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Open Document"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Link to Document : (If this link does not opens directly in web browser then copy an the link and paste in web browser.) ",IDC_STATIC,5,3,190,25
EDITTEXT IDEB_OPENDOC_LINK_TEXT,5,31,190,12,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Ok",IDCANCEL,150,45,45,14,WS_TABSTOP
END
IDD_WEB_SERVER_PORT_DIALOG DIALOGEX 0, 0, 160, 55
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "OpenERP Connection"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Server : ",IDC_STATIC,5,3,150,17
EDITTEXT IDET_WEB_SERVER,40,3,100,12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Port : ",IDC_STATIC,5,18,100,17
EDITTEXT IDET_WEB_PORT,40,18,100,12,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Close",IDCANCEL,110,35,45,14,WS_TABSTOP
DEFPUSHBUTTON "OK",ID_WEB_OK,60,35,45,14,WS_TABSTOP
END
IDD_SELECT_COUNTRY DIALOGEX 0, 0, 220, 250
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Search Country"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Enter Name : ",IDC_STATIC,8,12,80,17
EDITTEXT IDET_COUNTRY_SEARCH_NAME, 55, 10, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Search", IDPB_SEARCH_COUNTRY, 160, 10, 50, 14, WS_TABSTOP
CONTROL "List1",IDC_LIST_COUNTRY,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
LVS_SHOWSELALWAYS | LVS_EX_GRIDLINES | LVS_REPORT | LVS_EX_FULLROWSELECT, 8,40,200,185
PUSHBUTTON "Select", IDPB_SELECT_COUNTRY, 170, 230, 40, 14, WS_TABSTOP
END
IDD_SELECT_STATE DIALOGEX 0, 0, 220, 250
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Search Country"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Enter Name : ",IDC_STATIC,8,12,80,17
EDITTEXT IDET_STATE_SEARCH_NAME, 55, 10, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Search", IDPB_STATE_SEARCH, 160, 10, 50, 14, WS_TABSTOP
CONTROL "List1",IDC_LIST_STATE,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
LVS_SHOWSELALWAYS | LVS_EX_GRIDLINES | LVS_REPORT | LVS_EX_FULLROWSELECT, 8,40,200,185
PUSHBUTTON "Select", IDPB_SELECT_STATE, 170, 230, 40, 14, WS_TABSTOP
END

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
View File
@@ -90,4 +90,5 @@ def generateEML(mail):
print email.lastErrorText()
sys.exit()
print "Saved EML!",eml_path
return eml_path
View File
+92 -4
View File
@@ -58,7 +58,8 @@ class XMLRpcConn(object):
_public_methods_ = ['GetDBList', 'login', 'GetAllObjects', 'GetObjList', 'InsertObj', 'DeleteObject', 'GetCSList', \
'ArchiveToOpenERP', 'IsCRMInstalled', 'GetPartners', 'GetObjectItems', \
'CreateCase', 'MakeAttachment', 'CreateContact', 'CreatePartner', 'getitem', 'setitem', \
'SearchPartnerDetail', 'WritePartnerValues', 'GetAllState', 'GetAllCountry' ]
'SearchPartnerDetail', 'WritePartnerValues', 'GetAllState', 'GetAllCountry', 'SearchPartner', 'SearchEmailResources', \
'GetCountry', 'GetStates', 'FindCountryForState']
_reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER
_reg_clsid_ = "{C6399AFD-763A-400F-8191-7F9D0503CAE2}"
_reg_progid_ = "Python.OpenERP.XMLRpcConn"
@@ -262,9 +263,10 @@ class XMLRpcConn(object):
msg =fp.read()
fp.close()
new_mail = email.message_from_string(str(msg))
execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','process_email',section, str(new_mail))
except Exception,e:
win32ui.MessageBox(str(e),"Mail Reading Error")
execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','process_email',section, str(new_mail))
pass
def MakeAttachment(self, recs, mail):
attachments = mail.Attachments
@@ -303,12 +305,19 @@ class XMLRpcConn(object):
return result
def CreateContact(self, res=None):
import win32ui
res=eval(str(res))
partner = res['partner_id']
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 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]})
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]})
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner.address','create',res)
return id
@@ -340,10 +349,14 @@ class XMLRpcConn(object):
new_dict = dict(new_vals)
email=new_dict['email']
partner = new_dict['partner']
country_val = new_dict['country']
state_val = new_dict['state']
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))])
country_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country', 'search', [('name','=',ustr(country_val))])
state_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country.state', 'search', [('name','=',ustr(state_val))])
address_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(email))])
if not address_id:
if not partner_id or not address_id or not country_id or not state_id:
return flag
address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address','read',address_id[0],['id','partner_id','state_id','country_id'])
vals_res_address={
@@ -356,6 +369,8 @@ class XMLRpcConn(object):
'mobile' : new_dict['mobile'],
'fax' : new_dict['fax'],
'zip' : new_dict['zip'],
'country_id' : country_id[0],
'state_id' : state_id[0]
}
temp = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'write', address_id, vals_res_address)
if temp:
@@ -385,3 +400,76 @@ class XMLRpcConn(object):
obj = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.country','read', [country_id], ['id','name'])[0]
country_list.append((obj['id'], ustr(obj['name'])))
return country_list
def SearchPartner(self, partner = ""):
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:
return None
return partner_id[0]
def SearchEmailResources(self, mail):
import win32ui
import eml
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
sub = ""
res_vals = []
try:
parse_mail = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'email.server.tools','parse_message',mail)
win32ui.MessageBox(str(parse_mail),"Temp")
eml_path=eml.generateEML(mail)
fp = open(eml_path, 'rb')
msg =fp.read()
fp.close()
new_mail = email.message_from_string(str(msg))
sub = new_mail.get('Subject')
win32ui.MessageBox(str(sub),"Sub")
except Exception,e:
win32ui.MessageBox(str(e),"Mail Reading Error")
return None
mail_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mailgate.message', 'search', [('name','=',sub)])
if not mail_id:
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])
return res_vals
def GetCountry(self, country_search=''):
import win32ui
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))])
if ids:
ids.sort()
for id in ids:
object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country','read',[id],['id','name'])[0]
obj_list.append((object['id'], ustr(object['name'])))
obj_list.sort(lambda x, y: cmp(x[1],y[1]))
return obj_list
def GetStates(self, state_search=''):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids=[]
obj_list=[]
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',[('name','ilike',ustr(state_search))])
if ids:
ids.sort()
for id in ids:
object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','read',[id],['id','name'])[0]
obj_list.append((object['id'], ustr(object['name'])))
obj_list.sort(lambda x, y: cmp(x[1],y[1]))
return obj_list
def FindCountryForState(self, state_search=''):
import win32ui
res_vals = []
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','search',[('name','=',ustr(state_search))])
if not ids:
return None
object = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.country.state','read',ids)[0]
country = object['country_id'][1]
return country