Nimesh Contractor(Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-outlook.net-jam-thunderbird_cleanup-nco 
into lp:~openerp-dev/openobject-addons/trunk-outlook.net-jam.

Requested reviews:
  Jigar Amin  (OpenERP) (jam-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-outlook.net-jam-thunderbird_cleanup-nco/+merge/80895

Hello sir,
         
          I have remove the unused code and change the rpc calls as per your 
suggestion.

Thank You.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-outlook.net-jam-thunderbird_cleanup-nco/+merge/80895
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-outlook.net-jam.
=== modified file 'thunderbird/partner/partner.py'
--- thunderbird/partner/partner.py	2011-09-08 00:16:51 +0000
+++ thunderbird/partner/partner.py	2011-11-01 13:07:28 +0000
@@ -29,17 +29,15 @@
     _name = "thunderbird.partner"
     _description="Thunderbid Plugin Tools"
 
-    def create_contact(self,cr,user,vals):
+    def create_partner(self,cr,user,vals):
         dictcreate = dict(vals)
-        # Set False value if 'undefined' for record. Id User does not spicify the values, Thunerbird set 'undefined' by default for new contact.
-        for key in dictcreate:
-            if dictcreate[key] == 'undefined':
-                dictcreate[key] = False
-        if not eval(dictcreate.get('partner_id')):
-            dictcreate.update({'partner_id': False})
-        create_id = self.pool.get('res.partner.address').create(cr, user, dictcreate)
+        partner_obj = self.pool.get('res.partner')
+        search_id =  partner_obj.search(cr, user,[('name','=',dictcreate['name'])])
+        if search_id:
+            return 0
+        create_id =  partner_obj.create(cr, user, dictcreate)
         return create_id
-
+    
     def history_message(self, cr, uid, vals):
         dictcreate = dict(vals)
         ref_ids = str(dictcreate.get('ref_ids')).split(';')
@@ -53,7 +51,6 @@
         msg_ids = []
         res = {}
         res_ids = []
-        obj_list= ['crm.lead','project.issue','hr.applicant','res.partner']
         for ref_id in ref_ids:
             ref = ref_id.split(',')
             model = ref[0]
@@ -62,37 +59,12 @@
                 msg_ids = mail_message.search(cr, uid, [('message_id','=',message_id),('res_id','=',res_id),('model','=',model)])
                 if msg_ids and len(msg_ids):
                     continue
-            if model not in obj_list:
-                res={}
-                obj_attch = self.pool.get('ir.attachment')
-                ls = ['*', '/', '\\', '<', '>', ':', '?', '"', '|', '\t', '\n',':','~']
-                sub = msg.get('subject','NO-SUBJECT').replace(' ','')
-                if sub.strip() == '':
-                   sub = 'NO SBUJECT'
-                fn = sub
-                for c in ls:
-                   fn = fn.replace(c,'')
-                if len(fn) > 64:
-                   l = 64 - len(fn)
-                   f = fn.split('-')
-                   fn = '-'.join(f[1:])
-                   if len(fn) > 64:
-                      l = 64 - len(fn)
-                      f = fn.split('.')
-                      fn = f[0][0:l] + '.' + f[-1]
-                fn = fn[:-4]+'.eml'
-                res['res_model'] = model
-                res['name'] = msg.get('subject','NO-SUBJECT')+".eml"
-                res['datas_fname'] = fn
-                res['datas'] = base64.b64encode(mail)
-                res['res_id'] = res_id
-                obj_attch.create(cr, uid, res)
             threads = self.pool.get(model).browse(cr, uid, res_id)
 
             thread_pool.message_append(cr, uid,
                             [threads],
                             subject = msg.get('subject'),
-                            details = msg.get('body_text'),
+                            body_text = msg.get('body_text'),
                             email_to = msg.get('to'),
                             email_from = msg.get('from'),
                             email_cc = msg.get('cc'),
@@ -114,7 +86,7 @@
         return self.pool.get('mail.thread').message_process(cr, uid, model, message)
 
     def search_message(self, cr, uid, message, context=None):
-        #@param message: string of mail which is read from EML File
+        #@param message: string of mail which is read from Message
         #@return model,res_id
         references = []
         dictcreate = dict(message)
@@ -174,44 +146,6 @@
             }
         return res.items()
 
-    def update_contact(self, cr, user, vals):
-        dictcreate = dict(vals)
-        res_id = dictcreate.get('res_id',False)
-        result = {}
-        address_pool = self.pool.get('res.partner.address')
-        if not (dictcreate.get('partner_id')): # TOCHECK: It should be check res_id or not
-            dictcreate.update({'partner_id': False})
-            create_id = address_pool.create(cr, user, dictcreate)
-            return create_id
-
-        if res_id:
-            address_data = address_pool.read(cr, user, int(res_id), [])
-            result = {
-               'partner_id': address_data['partner_id'] and address_data['partner_id'][0] or False, #TOFIX: parter_id should take from address_data
-               'country_id': dictcreate['country_id'] and int(dictcreate['country_id'][0]) or False,
-               'state_id': dictcreate['state_id'] and int(dictcreate['state_id'][0]) or False,
-               'name': dictcreate['name'],
-               'street': dictcreate['street'],
-               'street2': dictcreate['street2'],
-               'zip': dictcreate['zip'],
-               'city': dictcreate['city'],
-               'phone': dictcreate['phone'],
-               'fax': dictcreate['fax'],
-               'mobile': dictcreate['mobile'],
-               'email': dictcreate['email'],
-            }
-        address_pool.write(cr, user, int(res_id), result )
-        return True
-
-    def create_partner(self,cr,user,vals):
-        dictcreate = dict(vals)
-        partner_obj = self.pool.get('res.partner')
-        search_id =  partner_obj.search(cr, user,[('name','=',dictcreate['name'])])
-        if search_id:
-            return 0
-        create_id =  partner_obj.create(cr, user, dictcreate)
-        return create_id
-
     def search_document(self,cr,user,vals):
         dictcreate = dict(vals)
         search_id = self.pool.get('ir.model').search(cr, user,[('model','=',dictcreate['model'])])

=== modified file 'thunderbird/plugin/openerp_plugin.xpi'
Binary files thunderbird/plugin/openerp_plugin.xpi	2011-06-16 10:25:18 +0000 and thunderbird/plugin/openerp_plugin.xpi	2011-11-01 13:07:28 +0000 differ
=== modified file 'thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar'
Binary files thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar	2011-06-16 10:25:18 +0000 and thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar	2011-11-01 13:07:28 +0000 differ
=== removed file 'thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/address.xul'
--- thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/address.xul	2011-01-14 00:11:01 +0000
+++ thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/address.xul	1970-01-01 00:00:00 +0000
@@ -1,110 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
-<!DOCTYPE window SYSTEM "chrome://openerp_plugin/locale/address.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.createContactAddress();" height="480" width="764">
-
-<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>
-<script type="text/javascript" src="chrome://openerp_plugin/content/static.js"></script>
-<script type="text/javascript" src="chrome://openerp_plugin/content/overlay.js"></script>
-
-<tabpanel id="contact">
-  <groupbox id="contact" style="border:1px solid black" width="752">
-    <separator class="groove-thin" orient="horizontal" width="94"/> 
-     <hbox>
-        <label  align="right" id="emailid"  value="&emailid.value;" width="94" />
-		 <textbox id="txtemail" width="268" align="right"/>
-         <spacer width="5"/>
-          <button label="&create.label;" accesskey="r" image="&imagecreate.value;" oncommand="Create.onMenuItemCommand(event);"/>
-         <button label="&bsearch.label;" oncommand="searchContactdetail();" image="&imagesearch.value;"/>
-	</hbox>
-	<hbox>
-        <label  align="right" id="name"  value="&name.value;" width="80" />
-		<textbox id="txtselectpartner" align="right" width="270" readonly="true"/>
-        <spacer width="5"/>
-	</hbox>
-    <separator class="groove-thin" orient="horizontal" width="94"/> 
-   </groupbox>
-</tabpanel>
-<separator class="groove-thin" orient="horizontal" width="94"/> 
-<tabpanel id="address">
-  <groupbox id="address" style="border:1px solid black">
-    <hbox >
-        <caption label="&postaladdress.value;" />
-    </hbox>
-    <separator class="groove-thin" orient="horizontal" width="94"/> 
-     <hbox>
-        <label  align="right" id="contactname"  value="&contactname.value;" width="80" />
-		<textbox id="txtcontactname" align="right" width="270" />
-	</hbox>
-    
-    <hbox>
-        <label  align="right" id="street"  value="&street.value;" width="97" />
-		<textbox id="txtstreet" width="270" align="right"/>
-	</hbox>
-    <hbox>
-        <label  align="right" id="street2"  value="&street2.value;" width="97" />
-		<textbox id="txtstreet2" width="270" align="right"/>
-	</hbox>
-
-     <hbox>
-        <label  align="right" id="zip"  value="&zip.value;" width="97" />
-		<textbox id="txtzip" align="right" />
-        <spacer width="115"/>
-	</hbox>
- 
-    <hbox>
-        <label  align="right" id="city"  value="&city.value;" width="97" />
-		<textbox id="txtcity" align="right" />
-    </hbox>
-
-    <hbox>
-         <label  align="right" id="countryname"  value="&country.value;" width="97" />
-         <menulist id="country" width="190">
-           <menupopup>
-	     <menuitem label="" value=""/>
-   	    </menupopup>
-      	  </menulist>
-	</hbox>
-
-     <hbox>
-         <label  align="right" id="statename"  value="&state.value;" width="97" />
-         <menulist id="state" width="190">
-           <menupopup>
-	     <menuitem label="" value=""/>
-   	    </menupopup>
-      	  </menulist>
-	</hbox>
-    <separator class="groove-thin" orient="horizontal" width="94"/> 
-</groupbox>
-<groupbox id="communication" style="border:1px solid black" width="310">
-   <vbox>
-        <caption label="&communication.value;" />
-     </vbox>
-    <separator class="groove-thin" orient="horizontal" width="94"/> 
-    <hbox>
-        <label  align="right" id="office"  value="&office.value;" width="50" />
-	    <textbox id="txtoffice" align="right"/>
-    </hbox>
-    <hbox>
-        <label  align="right" id="mobile"  value="&mobile.value;" width="50" />
-	    <textbox id="txtmobile" align="right"/>
-    </hbox> 
-    <hbox>
-        <label  align="right" id="fax"  value="&fax.value;" width="50" />
-	    <textbox id="txtfax" align="right"/>
-    </hbox> 
-</groupbox>
-</tabpanel>
-<description></description>
-
-<hbox align="right">
-    <button label="&cancel.label;" image="&imagecancel.value;" oncommand="close();"/>
-    <button label="&ok.label;" image="&imageok.value;" oncommand="UpdateContact();"/>
- 
-</hbox>
-
-</window>

=== modified file 'thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/tiny_xmlrpc.js'
--- thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/tiny_xmlrpc.js	2011-06-23 09:52:04 +0000
+++ thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/tiny_xmlrpc.js	2011-11-01 13:07:28 +0000
@@ -1303,9 +1303,9 @@
     var strpass = xmlRpcClient.createType(xmlRpcClient.STRING,{});
     strpass.data = branchobj.getCharPref("password");
     var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
-    strobj.data = 'thunderbird.partner';
+    strobj.data = 'res.partner.address';
     var strmethod = xmlRpcClient.createType(xmlRpcClient.STRING,{});
-    strmethod.data = 'search_contact';
+    strmethod.data = 'search';
     var strname = xmlRpcClient.createType(xmlRpcClient.STRING,{});
     strname.data = getSenderEmail();
     
@@ -1579,35 +1579,15 @@
     var strpass = xmlRpcClient.createType(xmlRpcClient.STRING,{});
     strpass.data = branchobj.getCharPref("password");
     var strmethod = xmlRpcClient.createType(xmlRpcClient.STRING,{});
-    strmethod.data = 'create_contact';
+    strmethod.data = 'create';
     var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
-    strobj.data = 'thunderbird.partner';
+    strobj.data = 'res.partner.address';
     var a = ['partner_id','name','street','street2','zip','city','country_id','state_id','phone','fax','mobile','email'];
     var b = [getPartnerId(),document.getElementById("txtname").value,document.getElementById("txtstreet").value,document.getElementById("txtstreet2").value,document.getElementById("txtzip").value, document.getElementById("txtcity").value,document.getElementById("country").value,document.getElementById("state").value,document.getElementById("txtoffice").value,document.getElementById("txtfax").value,document.getElementById("txtmobile").value,document.getElementById("txtemail").value];
     var arrofarr = dictcontact(a,b);
     xmlRpcClient.asyncCall(listCreateContactHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
 }
 
-function UpdateContact(){
-    var branchobj = getPref();
-    setServerService('xmlrpc/object');
-    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
-    var xmlRpcClient = getXmlRpc();
-    var strDbName = xmlRpcClient.createType(xmlRpcClient.STRING,{});
-    strDbName.data = branchobj.getCharPref("serverdbname");
-    var struids = xmlRpcClient.createType(xmlRpcClient.INT,{});
-    struids.data = branchobj.getIntPref('userid');
-    var strpass = xmlRpcClient.createType(xmlRpcClient.STRING,{});
-    strpass.data = branchobj.getCharPref("password");
-    var strmethod = xmlRpcClient.createType(xmlRpcClient.STRING,{});
-    strmethod.data = 'update_contact';
-    var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
-    strobj.data = 'thunderbird.partner';
-    var a = ['res_id','partner_id','name','street','street2','zip','city','country_id','state_id','phone','fax','mobile','email'];
-    var b = [getResourceId(),document.getElementById("txtselectpartner").value,document.getElementById("txtcontactname").value,document.getElementById("txtstreet").value,document.getElementById("txtstreet2").value,document.getElementById("txtzip").value, document.getElementById("txtcity").value,document.getElementById("country").value,document.getElementById("state").value,document.getElementById("txtoffice").value,document.getElementById("txtfax").value,document.getElementById("txtmobile").value,document.getElementById("txtemail").value];
-    var arrofarr = dictcontact(a,b);
-    xmlRpcClient.asyncCall(listUpdateContactHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
-}
 
 //xmlrpc request handler for creating a attachment record
 var listAttachHandler = {

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to