[IMP]: Improvement in outlook

bzr revid: ksa@tinyerp.co.in-20100929053339-elabt2cu43sy83an
This commit is contained in:
ksa (Open ERP) 2010-09-29 11:03:39 +05:30
parent f23903deb2
commit 926a310691
7 changed files with 199 additions and 244 deletions

View File

@ -1 +1,2 @@
python addin.py
pause

View File

@ -1 +1,2 @@
python addin.py --unregister
pause

View File

@ -162,7 +162,8 @@ hwndChk_list=[]
global search_text
search_text='search_text'
global partner_ref
partner_ref = ''
global name
name=''
global email
@ -774,13 +775,6 @@ def CreateContact(btnProcessor,*args):
return
partner = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
sel = win32gui.SendMessage(combo, win32con.CB_GETCURSEL)
state_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[10])
state_sel = win32gui.SendMessage(state_combo, win32con.CB_GETCURSEL)
coun_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
country_sel = win32gui.SendMessage(coun_combo, win32con.CB_GETCURSEL)
name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
email = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
office_no = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
@ -795,6 +789,7 @@ def CreateContact(btnProcessor,*args):
return
res = {
'partner_id':ustr(partner),
'name':ustr(name),
'email':ustr(email),
'phone':ustr(office_no),
@ -806,37 +801,8 @@ def CreateContact(btnProcessor,*args):
'zip':ustr(zip)
}
fs_id = c_id = -1
if not state_sel == -1 :
try:
temp = NewConn.GetAllState()
i = -1
for t in temp:
i+=1
if i == state_sel:
fs_id = t[0]
break;
res ['state_id'] = fs_id
except Exception, e:
msg = getMessage(e)
win32ui.MessageBox(msg, "New Partner", flag_error)
pass
if not country_sel == -1 :
try:
temp = NewConn.GetAllCountry()
i = -1
for t in temp:
i+=1
if i == country_sel:
c_id = t[0]
break;
res ['country_id'] = c_id
except Exception, e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Open Contact", flag_error)
pass
try:
id = NewConn.CreateContact(sel, str(res))
id = NewConn.CreateContact(str(res))
if not partner:
msg="New contact created."
else:
@ -848,9 +814,6 @@ def CreateContact(btnProcessor,*args):
win32ui.MessageBox(msg, "Create Contact", flag_info)
for i in range(0,9):
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[i], '')
win32gui.SendMessage(combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(state_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(coun_combo, win32con.CB_SETCURSEL, -1 )
win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.id)
def SetAllText(txtProcessor,*args):
@ -929,6 +892,8 @@ def SetDefaultContact(txtProcessor,*args):
global name
global email
global partner_ref
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[1],partner_ref)
if txtProcessor.init_done:
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.control_id,name)
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0],email)
@ -941,12 +906,9 @@ def SetDefaultContact(txtProcessor,*args):
except Exception,e:
pass
fs_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[1])
c_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[2])
win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.control_id,name)
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0],email)
txtProcessor.init_done = True
def setCheckList(groupProcessor,*args):
@ -1043,6 +1005,8 @@ def set_search_text(dialogProcessor,*args):
def set_name_email(dialogProcessor,*args):
global name
global email
global partner_ref
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[2], ustr(partner_ref))
name = win32gui.GetDlgItemText(dialogProcessor.window.hwnd, dialogProcessor.other_ids[0])
email = win32gui.GetDlgItemText(dialogProcessor.window.hwnd, dialogProcessor.other_ids[1])
@ -1051,6 +1015,8 @@ def GetDefaultEmail(txtProcessor,*args):
from win32com.client import Dispatch
import win32con
b = check()
global partner_ref
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0], ustr(partner_ref))
if not b:
return
#Acquiring control of the text box
@ -1070,96 +1036,67 @@ def GetDefaultEmail(txtProcessor,*args):
win32ui.MessageBox("Error In reading email ID from Email ","Open Contact", flag_error)
pass
win32gui.SendMessage(search_partner_box, win32con.WM_SETTEXT, 0, search_partner_text)
fs_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[10])
c_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[11])
partner_combo = win32gui.GetDlgItem(txtProcessor.window.hwnd, txtProcessor.other_ids[0])
if search_partner_text.strip() == "":
search_partner_text = None
return
vals = []
#Searching the res.partner.address for contact based on Sender Mail ID.
vals = NewConn.SearchPartnerDetail(search_partner_text)
#If no user Found.
if vals == None:
for i in range(1,10):
for i in range(1,12):
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[i], "")
win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
win32ui.MessageBox("No matching records found for : "+str(search_partner)+".","Open Contact", flag_excl)
return
else:
#If user Found than Setting the Value for the contact in fields.
for i in range(1,10):
for i in range(1,12):
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[i], "")
win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
for val in vals:
if val[0] == 'partner_id':
temp = list (NewConn.GetPartners())
i = -1
for t in temp:
i+=1
if t[1] == val[1][1] :
win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, i )
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[0], ustr(val[1][1]))
if val[0] == 'name' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[1], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[1], ustr(val[1]))
if val[0] == 'street' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[2], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[2], ustr(val[1]))
if val[0] == 'street2' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[3], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[3], ustr(val[1]))
if val[0] == 'zip' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[9], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[9], ustr(val[1]))
if val[0] == 'city' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[4], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[4], ustr(val[1]))
if val[0] == 'state_id' and val[1] != False :
id = i = -1
temp = list(NewConn.GetAllState())
for t in temp:
i+=1
if str(t[1]) == str(val[1][1]):
id = i
break;
sel = win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, id )
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[10], ustr(val[1][1]))
if val[0] == 'country_id' and val[1] != False :
id = i = -1
temp = list(NewConn.GetAllCountry())
for t in temp:
i+=1
if str(t[1]) == str(val[1][1]):
id = i
break;
sel = win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, id )
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[11], ustr(val[1][1]))
if val[0] == 'phone' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[5], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[5], ustr(val[1]))
if val[0] == 'mobile' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[6], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[6], ustr(val[1]))
if val[0] == 'fax' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[7], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[7], ustr(val[1]))
if val[0] == 'email' and val[1] != False :
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[8], str(val[1]))
win32gui.SetDlgItemText(txtProcessor.window.hwnd, txtProcessor.other_ids[8], ustr(val[1]))
txtProcessor.init_done=True
def SearchPartner(btnProcessor,*args):
b = check()
global partner_ref
if not b:
return
#hwnd For the List box
fs_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
c_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[12])
partner_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
try :
search_partner = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
if not search_partner:
@ -1170,79 +1107,51 @@ def SearchPartner(btnProcessor,*args):
vals = NewConn.SearchPartnerDetail(search_partner)
#if contact not found resetting all field to blank
if vals == None:
for i in range(2,11):
for i in range(1,13):
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[i], "")
win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
win32ui.MessageBox("No matching records found for : "+str(search_partner)+".","Open Contact", flag_excl)
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0], "<enter new search>")
return
#if contact found than setting the values for the contact.
else:
for i in range(2,11):
for i in range(1,13):
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[i], "")
win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, -1 )
win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, -1 )
for val in vals:
if val[0] == 'partner_id':
#Finding the partner index in list and setting it.
temp = list (NewConn.GetPartners())
i = -1
for t in temp:
i+=1
if t[1] == val[1][1] :
win32gui.SendMessage(partner_combo, win32con.CB_SETCURSEL, i )
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1], ustr(val[1][1]))
if val[0] == 'name' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2], ustr(val[1]))
if val[0] == 'street' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3], ustr(val[1]))
if val[0] == 'street2' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[4], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[4], ustr(val[1]))
if val[0] == 'zip' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[10], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[10], ustr(val[1]))
if val[0] == 'city' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[5], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[5], ustr(val[1]))
if val[0] == 'state_id' and val[1] != False :
#Finding the state index in list and setting it.
id = i = -1
temp = list(NewConn.GetAllState())
for t in temp:
i+=1
if str(t[1]) == str(val[1][1]):
id = i
break;
sel = win32gui.SendMessage(fs_combo, win32con.CB_SETCURSEL, id )
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[11], ustr(val[1][1]))
if val[0] == 'country_id' and val[1] != False :
#Finding the country index in list and setting it.
id = i = -1
temp = list(NewConn.GetAllCountry())
for t in temp:
i+=1
if str(t[1]) == str(val[1][1]):
id = i
break;
sel = win32gui.SendMessage(c_combo, win32con.CB_SETCURSEL, id )
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[12], ustr(val[1][1]))
if val[0] == 'phone' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[6], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[6], ustr(val[1]))
if val[0] == 'mobile' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[7], ustr(val[1]))
if val[0] == 'fax' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[8], ustr(val[1]))
if val[0] == 'email' and val[1] != False :
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9], str(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9], ustr(val[1]))
win32gui.SetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0], "<Enter new search>")
except Exception,e:
@ -1253,6 +1162,7 @@ def SearchPartner(btnProcessor,*args):
def WritePartner(btnProcessor,*args):
new_vals=[]
#Reading new value of the fields.
partner = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
contect_name = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
street = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[2])
street2 = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[3])
@ -1262,70 +1172,14 @@ def WritePartner(btnProcessor,*args):
fax = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[9])
email = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[10])
zip = win32gui.GetDlgItemText(btnProcessor.window.hwnd, btnProcessor.other_ids[11])
country_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[6])
country_sel = win32gui.SendMessage(country_combo, win32con.CB_GETCURSEL)
state_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[5])
state_sel = win32gui.SendMessage(state_combo, win32con.CB_GETCURSEL)
partner_combo = win32gui.GetDlgItem(btnProcessor.window.hwnd, btnProcessor.other_ids[0])
partner_sel = win32gui.SendMessage(partner_combo, win32con.CB_GETCURSEL)
#Checking that record not being saved without name or Partner
if contect_name.strip() == "":
win32ui.MessageBox("Please enter partner Contact Name name.", "Open Contact", flag_excl)
return
if partner_sel < 1:
win32ui.MessageBox("Please Select Partner From list.", "Open Contact", flag_excl)
return
fs_id = c_id = p_id = -1
#Finding the partner index in list finding it record ID.
if not partner_sel < 0 :
try:
temp = NewConn.GetPartners()
i = -1
for t in temp:
i+=1
if i == partner_sel:
p_id = t[0]
break;
except Exception, e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Open Contact", flag_error)
pass
#Finding the State index in list finding it record ID.
if not state_sel == -1 :
try:
temp = NewConn.GetAllState()
i = -1
for t in temp:
i+=1
if i == state_sel:
fs_id = t[0]
break;
except Exception, e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Open Contact", flag_error)
pass
#Finding the country index in list finding it record ID.
if not country_sel == -1 :
try:
temp = NewConn.GetAllCountry()
i = -1
for t in temp:
i+=1
if i == country_sel:
c_id = t[0]
break;
except Exception, e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Open Contact", flag_error)
pass
# Creating a list to write the values to the OpenERP
new_vals.append(['partner_id',p_id])
new_vals.append(['partner',partner])
new_vals.append(['name',contect_name])
new_vals.append(['street',street])
new_vals.append(['street2',street2])
new_vals.append(['city',city])
new_vals.append(['state_id',fs_id])
new_vals.append(['country_id',c_id])
new_vals.append(['phone',phone])
new_vals.append(['mobile',mobile])
new_vals.append(['email',email])
@ -1346,6 +1200,80 @@ def WritePartner(btnProcessor,*args):
elif flag == -1:
win32ui.MessageBox("Contact can not be Save.\nFirst select contact using Search.","Open Contact", flag_info)
def SetPartnerNameColumn(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 = "Partner Name"
lvc.cx = 275
win32gui.SendMessage(hwndList, commctrl.LVM_INSERTCOLUMN, 0, lvc.toparam())
listProcessor.init_done = True
def SelectPartnerFromList(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 partner_ref
if str(sel_text).strip() == "":
win32ui.MessageBox("Invalid Partner Selected.","Search Partner")
return
try:
partner_ref = str(sel_text)
except Exception,e:
pass
win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.other_ids[1])
return
elif sel_count < 1:
win32ui.MessageBox("You should Select atleast one partner.","Search Partner")
return
else:
win32ui.MessageBox("Multiple Selection is not allowded.","Search Partner")
return
def SearchPartnerList(btnProcessor,*args):
b = check()
if not b:
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))
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:
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())
except Exception,e:
msg = getMessage(e)
win32ui.MessageBox(msg, "Search Partner", flag_error)
pass
dialog_map = {
@ -1399,13 +1327,10 @@ dialog_map = {
),
"IDD_NEW_CONTACT_DIALOG" : (
(PartnersComboProcessor, "ID_PARTNER_DROPDOWNLIST", GetConn, ()),
(CountryComboProcessor, "ID_COUNTRY_DROPLIST", GetConn, ()),
(StateComboProcessor, "ID_FED_STATE_DROPLIST", GetConn, ()),
(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_DROPDOWNLIST ID_FED_STATE_DROPLIST ID_COUNTRY_DROPLIST", CreateContact, ()),
(TextProcessor, "ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT ID_FED_STATE_DROPLIST ID_COUNTRY_DROPLIST" , SetDefaultContact, ()),
(DialogCommand, "ID_NEW_PARTNER_BUTTON ID_CONTACT_NAME_TEXT ID_CONTACT_EMAIL_TEXT", "IDD_NEW_PARTNER_DIALOG", set_name_email, ()),
(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_PARTNER_DIALOG" : (
@ -1414,14 +1339,18 @@ dialog_map = {
),
"IDD_VIEW_PARTNER_DIALOG" : (
(PartnersComboProcessor, "ID_PARTNER_DROPLIST", GetConn, ()),
(StateComboProcessor, "ID_ALL_STATE_DROPDOWNLIST", GetConn, ()),
(CountryComboProcessor, "ID_ALL_COUNTRY_DROPDOWNLIST", GetConn, ()),
(TextProcessor, "IDET_SEARCH_PARTNER ID_PARTNER_DROPLIST 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 ID_ALL_STATE_DROPDOWNLIST ID_ALL_COUNTRY_DROPDOWNLIST", GetDefaultEmail, ()),
(CommandButtonProcessor, "IDPB_SEARCH_PARTNER IDET_SEARCH_PARTNER ID_PARTNER_DROPLIST 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 ID_ALL_STATE_DROPDOWNLIST ID_ALL_COUNTRY_DROPDOWNLIST", SearchPartner, ()),
(CommandButtonProcessor, "IDPB_WRITE_CHANGES ID_PARTNER_DROPLIST IDET_PARTNER_CONTACT_NAME IDET_PARTNER_STREET IDET_PARTNER_STREET2 IDET_PARTNER_CITY ID_ALL_STATE_DROPDOWNLIST ID_ALL_COUNTRY_DROPDOWNLIST IDET_PARTNER_OFFICENO IDET_PARTNER_MOBILENO IDET_PARTNER_EMAIL IDET_PARTNER_FAX IDET_ZIP", WritePartner, ()),
(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_NEW_PARTNER_DIALOG" ),
(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")
),
}

View File

@ -156,6 +156,9 @@
#define IDPB_WRITE_CHANGES 2059
#define ID_ALL_STATE_DROPDOWNLIST 2060
#define ID_ALL_COUNTRY_DROPDOWNLIST 2061
#define IDET_PARTNER_STATE 2062
#define IDET_PARTNER_COUNTRY 2063
#define IDET_PARTNER 2064
//
#define ID_STREET_TEXT 2062
#define ID_STREET2_TEXT 2063
@ -167,6 +170,13 @@
#define ID_PARTNER_DROPLIST 2069
#define ID_NEW_PART_BUTTON 2070
#define IDPB_NEWPARTNER_BUTTON 2071
#define IDD_SELECT_PARTNER 2073
#define IDC_LIST_PARTNER 2072
#define IDPB_SELECT_PARTNER 2075
#define IDET_PARTNER_SEARCH_NAME 2076
#define IDPB_PARTNER_SEARCH 2077
#define IDPB_CREATE_NEW_PARTNER 2078
#define ID_PARTNER_TEXT 2079
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED

File diff suppressed because one or more lines are too long

View File

@ -111,7 +111,7 @@ EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Push to OpenERP"
FONT 8, "Tahoma", 1000, 0, 0x0
BEGIN
GROUPBOX " Link to an Existing Documents ", IDC_STATIC_GROUP, 8,5,250,290,WS_TABSTOP
GROUPBOX "Link to an Existing Documents ", IDC_STATIC_GROUP, 8,5,250,290,WS_TABSTOP
LTEXT "Search for : ",IDC_STATIC,15,17,40,12
EDITTEXT ID_SEARCH_TEXT,60,15,120,12,ES_AUTOHSCROLL | WS_TABSTOP// left top width height
PUSHBUTTON "Search",ID_SEARCH,187,15,40,14,WS_TABSTOP
@ -131,7 +131,7 @@ BEGIN
PUSHBUTTON "Close",IDCANCEL,385,300,60,14,WS_TABSTOP
END
IDD_NEW_CONTACT_DIALOG DIALOGEX 0, 0, 350, 190
IDD_NEW_CONTACT_DIALOG DIALOGEX 0, 0, 350, 150
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Create a New Contact"
@ -139,26 +139,23 @@ FONT 8, "Tahoma", 1000, 0, 0x0
BEGIN
LTEXT "Select Partner : ",IDC_STATIC,13,20,50,17
COMBOBOX ID_PARTNER_DROPDOWNLIST, 70, 18, 200, 80 ,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "New Partner",ID_NEW_PARTNER_BUTTON,280,17,55,14, WS_TABSTOP
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
GROUPBOX "Postal Address ", IDC_STATIC_GROUP,10,35,175,125
GROUPBOX "Postal Address ", IDC_STATIC_GROUP,10,35,175,90
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
EDITTEXT ID_STREET_TEXT, 76, 66, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Street2 : ",IDC_STATIC, 18, 81, 40, 17
EDITTEXT ID_STREET2_TEXT, 76, 80, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Zip : ",IDC_STATIC,18, 94, 50, 17
LTEXT "Zip : ",IDC_STATIC, 18, 94, 50, 17
EDITTEXT ID_ZIP_TEXT,76, 93, 100, 12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "City : ",IDC_STATIC,18,108,50,17
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, 123, 40, 17
COMBOBOX ID_FED_STATE_DROPLIST, 76, 122, 100, 80,CBS_DROPDOWNLIST |WS_VSCROLL | WS_TABSTOP
LTEXT "Country : ",IDC_STATIC, 18, 137, 40, 17
COMBOBOX ID_COUNTRY_DROPLIST, 76, 136, 100, 80,CBS_DROPDOWNLIST |WS_VSCROLL | WS_TABSTOP
GROUPBOX "Communication ", IDC_STATIC_GROUP, 188, 35, 150, 125
GROUPBOX "Communication ", IDC_STATIC_GROUP, 188, 35, 150, 90
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
@ -168,8 +165,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,170,45,14, WS_TABSTOP
PUSHBUTTON "Save",ID_CONTACT_SAVE_BUTTON,240,170,45,14, WS_TABSTOP
PUSHBUTTON "Cancel",IDCANCEL,290,130,45,14, WS_TABSTOP
PUSHBUTTON "Save",ID_CONTACT_SAVE_BUTTON,240,130,45,14, WS_TABSTOP
END
IDD_NEW_PARTNER_DIALOG DIALOGEX 0, 0, 140,40
@ -192,11 +189,11 @@ FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Email ID : ",IDC_STATIC,32,17,40,12
EDITTEXT IDET_SEARCH_PARTNER, 70, 15, 200, 12, ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Search Partner ",IDPB_SEARCH_PARTNER,280,15,60,14,WS_TABSTOP
PUSHBUTTON "Search Contact ",IDPB_SEARCH_PARTNER,280,15,60,14,WS_TABSTOP
LTEXT "Partner Name : ",IDC_STATIC,13,42,50,17
COMBOBOX ID_PARTNER_DROPLIST, 70, 42, 200, 80 ,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "New Partner",ID_NEW_PART_BUTTON,280,41,60,14, WS_TABSTOP
EDITTEXT IDET_PARTNER,70, 42, 200, 12,ES_AUTOHSCROLL |ES_READONLY
PUSHBUTTON "Search Partner",ID_NEW_PART_BUTTON,280,41,60,14, WS_TABSTOP
GROUPBOX "Postal Address ", IDC_STATIC_GROUP,10,65,175,125
LTEXT "Contact Name : ",IDC_STATIC,18,83,50,17
@ -210,9 +207,9 @@ BEGIN
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
COMBOBOX ID_ALL_STATE_DROPDOWNLIST, 76, 153, 100, 50,CBS_DROPDOWNLIST |WS_VSCROLL | WS_TABSTOP
EDITTEXT IDET_PARTNER_STATE, 76, 153, 100, 12,ES_AUTOHSCROLL |ES_READONLY
LTEXT "Country :",IDC_STATIC, 18, 169, 35, 17
COMBOBOX ID_ALL_COUNTRY_DROPDOWNLIST, 76, 168,100,50,CBS_DROPDOWNLIST |WS_VSCROLL | WS_TABSTOP
EDITTEXT IDET_PARTNER_COUNTRY, 76, 168, 100, 12,ES_AUTOHSCROLL |ES_READONLY
GROUPBOX "Communication ", IDC_STATIC_GROUP, 188, 65, 152, 125
LTEXT "Phone : ",IDC_STATIC, 194, 83, 30, 17
@ -228,3 +225,22 @@ BEGIN
PUSHBUTTON "Save", IDPB_WRITE_CHANGES, 213, 195, 60, 14, WS_TABSTOP
PUSHBUTTON "Cancel", IDCANCEL, 281, 195, 60, 14, WS_TABSTOP
END
IDD_SELECT_PARTNER DIALOGEX 0, 0, 220, 250
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "Search Partner"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Enter Name : ",IDC_STATIC,8,12,80,17
EDITTEXT IDET_PARTNER_SEARCH_NAME, 55, 10, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Search", IDPB_PARTNER_SEARCH, 160, 10, 50, 14, WS_TABSTOP
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
END

View File

@ -209,12 +209,12 @@ class XMLRpcConn(object):
obj_list = [ustr(item['name']).encode('iso-8859-1') for item in objects]
return obj_list
def GetPartners(self):
def GetPartners(self, search_partner=''):
import win32ui
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
ids=[]
obj_list=[]
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',[])
ids = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner','search',[('name','ilike',ustr(search_partner))])
if ids:
ids.sort()
obj_list.append((-999, ustr('')))
@ -302,13 +302,13 @@ class XMLRpcConn(object):
result[obj].update({obj_id: attachment_ids})
return result
def CreateContact(self, sel=None, res=None):
def CreateContact(self, res=None):
import win32ui
res=eval(str(res))
self.partner_id_list=eval(str(self.partner_id_list))
if self.partner_id_list.get(sel,-999) != -999:
res['partner_id'] = self.partner_id_list[sel]
partner = res['partner_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]})
id = execute(conn,'execute',self._dbname,int(self._uid),self._pwd,'res.partner.address','create',res)
return id
@ -339,12 +339,16 @@ class XMLRpcConn(object):
flag = -1
new_dict = dict(new_vals)
email=new_dict['email']
partner = new_dict['partner']
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))])
address_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(email))])
if not address_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={ 'name' : new_dict['name'],
vals_res_address={
'partner_id' : partner_id[0],
'name' : new_dict['name'],
'street':new_dict['street'],
'street2' : new_dict['street2'],
'city' : new_dict['city'],
@ -353,12 +357,6 @@ class XMLRpcConn(object):
'fax' : new_dict['fax'],
'zip' : new_dict['zip'],
}
if new_dict['partner_id'] != -1:
vals_res_address['partner_id'] = new_dict['partner_id']
if new_dict['state_id'] != -1:
vals_res_address['state_id'] = new_dict['state_id']
if new_dict['country_id'] != -1:
vals_res_address['country_id'] = new_dict['country_id']
temp = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'write', address_id, vals_res_address)
if temp:
flag=1