2 In order to test Importing contacts from any google account into OpenERP,
3 I use a gmail account and import the contact details and create Partners.
5 I create a record for the gmail account for which I want to import the contacts.
7 !record {model: google.login, id: google_login_id1}:
8 user: testmail.openerp@gmail.com
11 I login into that account.
13 !python {model: google.login}: |
14 self.login(cr, uid, [ref('google_login_id1')], context)
16 Now I select from which group I want to get the contact details and I want to create partner for all contacts.
18 !record {model: synchronize.google.import, id: synchronize_google_import_id1}:
19 create_partner: create_all
22 I import the contacts.
24 !python {model: synchronize.google.import}: |
25 self.import_google(cr, uid, [ref('synchronize_google_import_id1')], context={'contact':True})
27 I check whether the Partners are created or not.
29 !python {model: res.partner.address }: |
30 addr_obj = self.pool.get('ir.model.data')
31 addr_ids = addr_obj.search(cr, uid, [])
32 data_ids = addr_obj.search(cr, uid, [('model','=','res.partner.address'),('module','=','synchronize_google')])
33 address_ids = map(lambda x: x.res_id, [child for child in addr_obj.browse(cr, uid, data_ids) if child.res_id])
34 partner_ids = map(lambda x: x.partner_id.id, [addr for addr in self.browse(cr, uid, address_ids) if addr.partner_id])
35 assert partner_ids, 'Partners not created !'