@@ -182,12 +182,10 @@ class thunderbird_partner(osv.osv_memory):
|
||||
#@param message: string of mail which is read from EML File
|
||||
#@return model,res_id
|
||||
dictcreate = dict(message)
|
||||
message = dictcreate.get('message')
|
||||
message_id = dictcreate.get('message_id')
|
||||
msg_pool = self.pool.get('mailgate.message')
|
||||
msg = self.pool.get('email.server.tools').parse_message(message)
|
||||
message_id = msg.get('message-id', False)
|
||||
model = False
|
||||
res_id = False
|
||||
model = ''
|
||||
res_id = 0
|
||||
if message_id:
|
||||
msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id)])
|
||||
if msg_ids and len(msg_ids):
|
||||
@@ -196,6 +194,7 @@ class thunderbird_partner(osv.osv_memory):
|
||||
res_id = msg.res_id
|
||||
return (model,res_id)
|
||||
|
||||
|
||||
def search_contact(self, cr, user, email):
|
||||
address_pool = self.pool.get('res.partner.address')
|
||||
address_ids = address_pool.search(cr, user, [('email','=',email)])
|
||||
@@ -314,14 +313,16 @@ 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")
|
||||
state_country_list = cr.fetchall()
|
||||
return state_country_list
|
||||
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
|
||||
|
||||
|
||||
def search_document_attachment(self,cr,user,vals):
|
||||
model_obj = self.pool.get('ir.model')
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
<!DOCTYPE window SYSTEM "chrome://openerp_plugin/locale/create.dtd">
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
title="&title.label;" onload="myPrefObserver.createContact()" height="460" width="860">
|
||||
title="&title.label;" onload="myPrefObserver.createContact();" height="460" width="860">
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/tiny_xmlrpc.js"></script>
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/config.js"></script>
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/loaddata.js"></script>
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
<hbox>
|
||||
<label align="right" id="countryname" value="&country.value;" width="97" />
|
||||
<menulist id="country" width="190">
|
||||
<menulist id="country" width="190" oncommand= "getAllState();" >
|
||||
<menupopup>
|
||||
<menuitem label="" value=""/>
|
||||
</menupopup>
|
||||
|
||||
@@ -49,9 +49,9 @@ var myPrefObserver =
|
||||
document.getElementById("txtname").value = getSenderName();
|
||||
document.getElementById("txtemail").value = getSenderEmail();
|
||||
document.getElementById("country").value = getAllCountry();
|
||||
document.getElementById("state").value = getAllState();
|
||||
setPartnerId(0);
|
||||
},
|
||||
|
||||
|
||||
//sets the value of email information in preferences and adds observer for the window
|
||||
register: function()
|
||||
@@ -100,8 +100,6 @@ var myPrefObserver =
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
createContactAddress: function()
|
||||
{
|
||||
document.getElementById("txtselectpartner").value = getPartnerName();
|
||||
|
||||
@@ -301,10 +301,17 @@ var listDocumentHandler = {
|
||||
res_id = res.QueryElementAt(1, Components.interfaces.nsISupportsPRInt32);
|
||||
model = res.QueryElementAt(0, Components.interfaces.nsISupportsCString);
|
||||
weburl = getWebServerURL();
|
||||
|
||||
var t = weburl + "/openerp/form/view?model=" + model +"&id=" + res_id;
|
||||
window.open(t, "", "chrome","resizable=yes,scrollbars=yes,status=yes");
|
||||
|
||||
if(res_id==0)
|
||||
{
|
||||
alert("Document is not available.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
var t = weburl + "/openerp/form/view?model=" + model +"&id=" + res_id;
|
||||
window.open(t, "", "chrome","resizable=yes,scrollbars=yes,status=yes,");
|
||||
}
|
||||
|
||||
},
|
||||
onFault: function (client, ctxt, fault) {
|
||||
|
||||
@@ -341,7 +348,15 @@ function open_document()
|
||||
IETtotal = emlsArray.length;
|
||||
IETexported = 0;
|
||||
var msguri = emlsArray[0];
|
||||
|
||||
//gives the selected email uri
|
||||
var messageUri= gDBView.URIForFirstSelectedMessage;
|
||||
|
||||
var messenger = Components.classes['@mozilla.org/messenger;1'].createInstance(Components.interfaces.nsIMessenger);
|
||||
|
||||
//gives the selected email object
|
||||
var message = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri);
|
||||
|
||||
|
||||
var branchobj = getPref();
|
||||
setServerService('xmlrpc/object');
|
||||
@@ -357,9 +372,8 @@ function open_document()
|
||||
strmethod.data = 'search_message';
|
||||
var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
|
||||
strobj.data = 'thunderbird.partner';
|
||||
var eml_string = parse_eml()
|
||||
var a = ['message'];
|
||||
var b = [eml_string];
|
||||
var a = ['message_id'];
|
||||
var b = ['<'+message.messageId+'>'];
|
||||
var arrofarr = dictcontact(a,b);
|
||||
xmlRpcClient.asyncCall(listDocumentHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
|
||||
}
|
||||
|
||||
+15
-6
@@ -773,10 +773,9 @@ var listAllCountryHandler = {
|
||||
var popup = document.getElementById("country"); // a <menupopup> element
|
||||
for (i=0;i<arrPartnerList.length;i++){
|
||||
popup.menupopup.appendChild(createMenuItem_partner(arrPartnerList[i][1],arrPartnerList[i][0]));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
onFault: function (client, ctxt, fault) {
|
||||
|
||||
@@ -794,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);
|
||||
@@ -803,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;
|
||||
}
|
||||
|
||||
},
|
||||
@@ -878,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,{});
|
||||
@@ -889,7 +900,7 @@ function getAllState(){
|
||||
var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
|
||||
strobj.data = 'thunderbird.partner';
|
||||
var strvalue = xmlRpcClient.createType(xmlRpcClient.STRING,{});
|
||||
strvalue.data = document.getElementById("state").value;
|
||||
strvalue.data = document.getElementById("country").value;
|
||||
xmlRpcClient.asyncCall(listAllStateHandler,null,'execute',[ strDbName,struid,strpass,strobj,strmethod,strvalue ],6);
|
||||
}
|
||||
|
||||
@@ -1439,7 +1450,6 @@ function parse_eml(){
|
||||
}
|
||||
|
||||
name = fpath + getFileName() +".eml"
|
||||
|
||||
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||
file.initWithPath( name );
|
||||
if ( file.exists() == false ) {
|
||||
@@ -1831,7 +1841,6 @@ function testConnection(){
|
||||
function testConnection_web(){
|
||||
var branchobj = getPref();
|
||||
weburl = getWebServerURL();
|
||||
alert(weburl);
|
||||
window.open(weburl, "", "chrome","resizable=yes,scrollbars=yes,status=yes");
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user