[ADD]import_google: Changes in yml file of contact and calander
bzr revid: dbr@tinyerp.com-20110615115146-su4fj3kwwu7kl0q3
This commit is contained in:
parent
a36854f491
commit
03d536c1cf
|
@ -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',
|
||||
],
|
||||
|
|
|
@ -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 !'
|
||||
|
||||
|
||||
|
|
|
@ -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 !'
|
||||
|
|
@ -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 !'
|
||||
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<group colspan="2" col="2"/>
|
||||
<group colspan="2" col="2">
|
||||
<button special="cancel" string="_Cancel" icon="gtk-cancel"/>
|
||||
<button name="import_contact" string="_Import Contacts" type="object" icon="terp-personal+"/>
|
||||
<button name="import_google" string="_Import Contacts" type="object" icon="terp-personal+"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
|
@ -46,7 +46,7 @@
|
|||
<group colspan="2" col="2"/>
|
||||
<group colspan="2" col="2">
|
||||
<button special="cancel" string="_Cancel" icon="gtk-cancel"/>
|
||||
<button name="import_contact" string="_Import Events" type="object" icon="terp-calendar"/>
|
||||
<button name="import_google" string="_Import Events" type="object" icon="terp-calendar"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
|
@ -58,7 +58,7 @@
|
|||
<record model="ir.actions.act_window" id="act_google_login_form">
|
||||
<field name="name">Import Google Calendar</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">google.login.contact</field>
|
||||
<field name="res_model">google.login</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
|
@ -69,7 +69,7 @@
|
|||
<record model="ir.actions.act_window" id="act_google_login_contact_form">
|
||||
<field name="name">Import Google Contacts</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">google.login.contact</field>
|
||||
<field name="res_model">google.login</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
|
|
Loading…
Reference in New Issue