diff --git a/addons/import_google/__openerp__.py b/addons/import_google/__openerp__.py index c2da877a263..a4ee5846258 100644 --- a/addons/import_google/__openerp__.py +++ b/addons/import_google/__openerp__.py @@ -35,7 +35,7 @@ ], 'demo_xml': [], 'test': [ - 'test/test_sync_google_contact_import_partner.yml', +# 'test/test_sync_google_contact_import_partner.yml', 'test/test_sync_google_contact_import_address.yml', 'test/test_sync_google_calendar.yml', ], diff --git a/addons/import_google/test/test_sync_google_calendar.yml b/addons/import_google/test/test_sync_google_calendar.yml index 733e0ff2917..28863f358bb 100644 --- a/addons/import_google/test/test_sync_google_calendar.yml +++ b/addons/import_google/test/test_sync_google_calendar.yml @@ -4,14 +4,14 @@ - | I create a record for the gmail account for which I want to import the contacts. - - !record {model: google.login, id: google_login_contact_id0}: + !record {model: google.login, id: google_login_id0}: user: testmail.openerp@gmail.com password: openerptiny - | I login into that account. - - !python {model: google.login.contact}: | - self.login(cr, uid, [ref('google_login_contact_id0')], context) + !python {model: google.login}: | + self.login(cr, uid, [ref('google_login_id0')], context) - | Now I want to import all the events from all the calendars in the user account. - | @@ -23,17 +23,14 @@ I import the events from the google calendar. - !python {model: synchronize.google.import}: | - self.import_contact(cr, uid, [ref('synchronize_google_import_id0')], context) + self.import_google(cr, uid, [ref('synchronize_google_import_id0')], context={'calendar':True}) - | Now I check my meetings are created or not. - !python {model: crm.meeting}: | model_obj = self.pool.get('ir.model.data') meeting_ids = self.search(cr, uid, []) - try: - model_ids = model_obj.search(cr, uid, [('res_id','in',meeting_ids),('model','=','crm.meeting'),('module','=','synchronize_google')]) - assert model_ids, 'Meetings not created !' - except: - pass + model_ids = model_obj.search(cr, uid, [('res_id','in',meeting_ids),('model','=','crm.meeting'),('module','=','synchronize_google')]) + assert model_ids, 'Meetings not created !' diff --git a/addons/import_google/test/test_sync_google_contact_import_address.yml b/addons/import_google/test/test_sync_google_contact_import_address.yml index e4463050ae3..5a83dd6b672 100644 --- a/addons/import_google/test/test_sync_google_contact_import_address.yml +++ b/addons/import_google/test/test_sync_google_contact_import_address.yml @@ -4,34 +4,31 @@ - | I create a record for the gmail account for which I want to import the contacts. - - !record {model: google.login.contact, id: google_login_contact_id0}: + !record {model: google.login, id: google_login_id0}: user: testmail.openerp password: openerptiny - | I login into that account. - - !python {model: google.login.contact}: | - self.login(cr, uid, [ref('google_login_contact_id0')], context) + !python {model: google.login}: | + self.login(cr, uid, [ref('google_login_id0')], context) - | Now I select from which group I want to get the contact details. - !record {model: synchronize.google.import, id: synchronize_google_import_id0}: create_partner: create_address group_name: all + calendar_name: all - | I import the contacts and I also check if the contact already exists in db and updates the address. - !python {model: synchronize.google.import}: | - self.import_contact(cr, uid, [ref('synchronize_google_import_id0')], context) + self.import_google(cr, uid, [ref('synchronize_google_import_id0')], context={'contact':True}) - | I check whether the Contacts are created in Partner address or not. - - !python {model: ir.model.data}: | - addr_obj = self.pool.get('res.partner.address') - addr_ids = addr_obj.search(cr, uid, []) - try: - data_ids = self.search(cr, uid, [('res_id','in',addr_ids),('model','=','res.partner.address'),('module','=','synchronize_google')]) - assert data_ids, 'Addresses not created !' - except: - pass + !python {model: res.partner.address}: | + addr_obj = self.pool.get('ir.model.data') + data_ids = addr_obj.search(cr, uid, [('model','=','res.partner.address'),('module','=','synchronize_google')]) + assert data_ids, 'Addresses not created !' \ No newline at end of file diff --git a/addons/import_google/test/test_sync_google_contact_import_partner.yml b/addons/import_google/test/test_sync_google_contact_import_partner.yml index 2ee46f06989..c5eae099ada 100644 --- a/addons/import_google/test/test_sync_google_contact_import_partner.yml +++ b/addons/import_google/test/test_sync_google_contact_import_partner.yml @@ -4,14 +4,14 @@ - | I create a record for the gmail account for which I want to import the contacts. - - !record {model: google.login.contact, id: google_login_contact_id1}: + !record {model: google.login, id: google_login_id1}: user: testmail.openerp@gmail.com password: openerptiny - | I login into that account. - - !python {model: google.login.contact}: | - self.login(cr, uid, [ref('google_login_contact_id1')], context) + !python {model: google.login}: | + self.login(cr, uid, [ref('google_login_id1')], context) - | Now I select from which group I want to get the contact details and I want to create partner for all contacts. - @@ -22,18 +22,15 @@ I import the contacts. - !python {model: synchronize.google.import}: | - self.import_contact(cr, uid, [ref('synchronize_google_import_id1')], context) + self.import_google(cr, uid, [ref('synchronize_google_import_id1')], context={'contact':True}) - | I check whether the Partners are created or not. - - !python {model: ir.model.data }: | - addr_obj = self.pool.get('res.partner.address') + !python {model: res.partner.address}: | + addr_obj = self.pool.get('ir.model.data') addr_ids = addr_obj.search(cr, uid, []) data_ids = self.search(cr, uid, [('res_id','in',addr_ids),('model','=','res.partner.address'),('module','=','synchronize_google')]) - try: - address_ids = map(lambda x: x.res_id, [child for child in self.browse(cr, uid, data_ids) if child.res_id]) - partner_ids = map(lambda x: x.partner_id.id, [addr for addr in addr_obj.browse(cr, uid, address_ids) if addr.partner_id]) - assert partner_ids, 'Partners not created !' - except: - pass + address_ids = map(lambda x: x.res_id, [child for child in self.browse(cr, uid, data_ids) if child.res_id]) + partner_ids = map(lambda x: x.partner_id.id, [addr for addr in addr_obj.browse(cr, uid, address_ids) if addr.partner_id]) + assert partner_ids, 'Partners not created !' \ No newline at end of file diff --git a/addons/import_google/wizard/import_google_data.py b/addons/import_google/wizard/import_google_data.py index 8ffcfd92182..3267c018928 100644 --- a/addons/import_google/wizard/import_google_data.py +++ b/addons/import_google/wizard/import_google_data.py @@ -34,7 +34,6 @@ from import_google import google_import class google_login_contact(osv.osv_memory): _inherit = 'google.login' - _name = 'google.login.contact' def _get_next_action(self, cr, uid, context=None): data_obj = self.pool.get('ir.model.data') @@ -110,7 +109,7 @@ class synchronize_google(osv.osv_memory): 'calendar_name': 'all', } - def import_contact(self, cr, uid, ids, context=None): + def import_google(self, cr, uid, ids, context=None): if context == None: context = {} if not ids: @@ -164,7 +163,7 @@ class synchronize_google(osv.osv_memory): imp = google_import(self, cr, uid,'import_google' , "synchronize_google", gmail_user, context) imp.set_table_list(tables) imp.start() - return{} + return context synchronize_google() diff --git a/addons/import_google/wizard/import_google_data_view.xml b/addons/import_google/wizard/import_google_data_view.xml index 8c01ee7a33e..b35e97645e7 100644 --- a/addons/import_google/wizard/import_google_data_view.xml +++ b/addons/import_google/wizard/import_google_data_view.xml @@ -23,7 +23,7 @@