[IMP]: solve problem for state and country list

bzr revid: ksa@tinyerp.co.in-20101008063236-vydlv0v2r3z6v8dz
This commit is contained in:
ksa (Open ERP) 2010-10-08 12:02:36 +05:30
parent 2d5ca6fa19
commit 0755f5d7dc
5 changed files with 15 additions and 5 deletions

View File

@ -313,13 +313,13 @@ class thunderbird_partner(osv.osv_memory):
def list_allcountry(self,cr,user,vals):
country_list = []
cr.execute("SELECT id, name from res_country")
cr.execute("SELECT id, name from res_country order by name")
country_list = cr.fetchall()
return country_list
def list_allstate(self,cr,user,vals):
cr.execute("select id, name from res_country_state where country_id = %s",(vals,) )
cr.execute("select id, name from res_country_state where country_id = %s order by name",(vals,) )
state_country_list = cr.fetchall()
return state_country_list

View File

@ -100,8 +100,6 @@ var myPrefObserver =
},
createContactAddress: function()
{
document.getElementById("txtselectpartner").value = getPartnerName();

View File

@ -793,7 +793,7 @@ var listAllStateHandler = {
var arrIdList = result.QueryInterface(Components.interfaces.nsISupportsArray);
// Set the number of results
var count = arrIdList.Count();
// Loop through the results, adding items to the list
for (i = 0; i < count; i++) {
var strlResult = arrIdList.QueryElementAt(i, Components.interfaces.nsISupportsArray);
@ -802,16 +802,20 @@ var listAllStateHandler = {
arrDataPair[0] = strlResult.QueryElementAt(0, Components.interfaces.nsISupportsPRInt32);
arrDataPair[1] = strlResult.QueryElementAt(1, Components.interfaces.nsISupportsCString);
arrPartnerList1[i] = arrDataPair;
}
if (!context)
{
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var popup = document.getElementById("state");
// a <menupopup> element
for (i=0;i<arrPartnerList1.length;i++){
popup.menupopup.appendChild(createMenuItem_partner(arrPartnerList1[i][1],arrPartnerList1[i][0]));
}
// popup.menupopup.selectedItem = popup.menupopup.firstChild;
}
},
@ -877,6 +881,14 @@ function getAllState(){
setServerService('xmlrpc/object');
var xmlRpcClient = getXmlRpc();
arrPartnerList1 = [];
var state = document.getElementById('state').menupopup;
while (state.firstChild)
{
//The list is LIVE so it will re-index each call
state.removeChild(state.firstChild);
};
var strDbName = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strDbName.data = branchobj.getCharPref("serverdbname");
var struid = xmlRpcClient.createType(xmlRpcClient.INT,{});