[IMP] sync_google_contact: Update and link google contact with partner address if...
authorUjjvala Collins (OpenERP) <uco@tinyerp.com>
Thu, 24 Feb 2011 06:24:40 +0000 (11:54 +0530)
committerUjjvala Collins (OpenERP) <uco@tinyerp.com>
Thu, 24 Feb 2011 06:24:40 +0000 (11:54 +0530)
bzr revid: uco@tinyerp.com-20110224062440-hjv3lt64khgp5kg7

addons/sync_google_contact/sync_google_contact.py
addons/sync_google_contact/wizard/google_contact_import.py

index 9e580af..9e7e3f4 100644 (file)
@@ -26,7 +26,7 @@ class res_partner_address(osv.osv):
 
     def unlink(self, cr, uid, ids, context=None):
         model_obj = self.pool.get('ir.model.data')
-        model_ids = model_obj.search(cr, uid, [('res_id','in',ids)], context=context)
+        model_ids = model_obj.search(cr, uid, [('res_id','in',ids),('model','=','res.partner.address'),('module','=','sync_google_contact')], context=context)
         model_obj.unlink(cr, uid, model_ids, context=context)
         return super(res_partner_address, self).unlink(cr, uid, ids, context=context)
 
index cef7cce..21c6d09 100644 (file)
@@ -220,7 +220,10 @@ class synchronize_google_contact(osv.osv_memory):
 
                 if contact_ids:
                     addresses.append(contact_ids[0])
-                    self.update_contact( cr, uid, contact_ids, data,context=context)
+                    self.update_contact(cr, uid, contact_ids, data, context=context)
+                    data_ids = model_obj.search(cr, uid, [('res_id','=',contact_ids[0]), ('google_id','=','')])
+                    model_data.update({'google_id': google_id})
+                    model_obj.write(cr, uid, data_ids, model_data, context=context)
                 if not contact_ids:
                     #create or link to an existing partner only if it's a new contact
                     res_id = addresss_obj.create(cr, uid, data, context=context)