[IMP]: Improvement in archive mail

bzr revid: ksa@tinyerp.co.in-20100920101533-043zv54yk54b4f8i
This commit is contained in:
ksa (Open ERP) 2010-09-20 15:45:33 +05:30
parent 4664b3433c
commit b3bc28d3df
4 changed files with 32 additions and 15 deletions

View File

@ -156,22 +156,21 @@ class thunderbird_partner(osv.osv_memory):
server_tools_pool = self.pool.get('email.server.tools') server_tools_pool = self.pool.get('email.server.tools')
message_id = msg.get('message-id', False) message_id = msg.get('message-id', False)
msg_pool = self.pool.get('mailgate.message') msg_pool = self.pool.get('mailgate.message')
msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id)])
res = {} res = {}
res_ids = [] res_ids = []
if msg_ids and len(msg_ids):
return 0
for ref_id in ref_ids: for ref_id in ref_ids:
msg_new = dictcreate.get('message') msg_new = dictcreate.get('message')
ref = ref_id.split(',') ref = ref_id.split(',')
model = ref[0] model = ref[0]
model_obj = self.pool.get(model) res_id = int(ref[1])
model_data = model_obj.search(cr, uid,[('name', 'ilike', ref[1])]) if message_id:
if model_data: msg_ids = msg_pool.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)])
res_id = int(model_data[0]) if msg_ids and len(msg_ids):
server_tools_pool.history_message(cr, uid, model, res_id, msg_new) continue
res_ids.append(res_id) server_tools_pool.history_message(cr, uid, model, res_id, msg_new)
res_ids.append(res_id)
return len(res_ids) return len(res_ids)
def process_email(self, cr, uid, vals): def process_email(self, cr, uid, vals):

View File

@ -1220,7 +1220,7 @@ var listSearchCheckboxHandler = {
listcell.setAttribute("height",12); listcell.setAttribute("height",12);
listcell.setAttribute("label",arrFinalList[i][j][1]); //stores the name ofthe record listcell.setAttribute("label",arrFinalList[i][j][1]); //stores the name ofthe record
listItem.appendChild(listcell); listItem.appendChild(listcell);
listItem.value = arrFinalList[i][j][1]; //stores the name of the record listItem.value = arrFinalList[i][j][0]; //stores the id of the record
listItem.label = arr1[i]; // stores the value of the object listItem.label = arr1[i]; // stores the value of the object
cmbSearchList.appendChild(listItem); cmbSearchList.appendChild(listItem);
} }
@ -1399,13 +1399,13 @@ var listArchiveHandler = {
} }
else if (createId<0) else if (createId<0)
{ {
alert("sorry Mail is not Archived to" +" " + ":" + " "+ list_documents.value); alert("sorry Mail is not Archived");
} }
else if (createId>=1) else if (createId>=1)
{ {
alert("Mail Archived Successfully to" +" " + ":" + " "+ list_documents.value); alert("Mail Archived Successfully");
} }
window.close(); window.close();
@ -1491,6 +1491,24 @@ function upload_archivemail()
} }
var listArchiveDocumentHandler = {
onResult: function(client, context, result) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var createId = result.QueryInterface(Components.interfaces.nsISupportsPRInt32);
var popup = document.getElementById("section").selectedItem;
alert("Document Created Successfully For " +" " + ":" + " "+ popup.label);
window.close();
},
onFault: function (client, ctxt, fault) {
},
onError: function (client, ctxt, status, errorMsg) {
}
}
function create_archivemail(){ function create_archivemail(){
var popup = document.getElementById("section").selectedItem; var popup = document.getElementById("section").selectedItem;
// a <menupopup> element // a <menupopup> element
@ -1517,10 +1535,10 @@ function create_archivemail(){
var a = ['model', 'message']; var a = ['model', 'message'];
var b = [object, eml_string]; var b = [object, eml_string];
var arrofarr = dictcontact(a,b); var arrofarr = dictcontact(a,b);
xmlRpcClient.asyncCall(listArchiveHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6); xmlRpcClient.asyncCall(listArchiveDocumentHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
alert("Document Created Successfully For " +" " + ":" + " "+ popup.label); //alert("Document Created Successfully For " +" " + ":" + " "+ popup.label);
} }
window.close(); //window.close();
} }
else else
{ {