[IMP] import_google: removed option to create only addresses (it's same object now)
bzr revid: qdp-launchpad@openerp.com-20120629111330-o5d15s49q27x7rh8
This commit is contained in:
parent
08d25cb352
commit
9fa150527f
|
@ -37,7 +37,6 @@
|
||||||
'demo_xml': [],
|
'demo_xml': [],
|
||||||
'test': [
|
'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',
|
#'test/test_sync_google_calendar.yml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
-
|
|
||||||
In order to test Importing contacts from any google account into OpenERP,
|
|
||||||
I use a gmail account and import the contact details and store them as Partner addresses.
|
|
||||||
- |
|
|
||||||
I create a record for the gmail account for which I want to import the contacts.
|
|
||||||
-
|
|
||||||
!record {model: google.login, id: google_login_id0}:
|
|
||||||
user: testmail.openerp@gmail.com
|
|
||||||
password: openerptiny
|
|
||||||
- |
|
|
||||||
I login into that account.
|
|
||||||
-
|
|
||||||
!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_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: res.partner}: |
|
|
||||||
addr_obj = self.pool.get('ir.model.data')
|
|
||||||
data_ids = addr_obj.search(cr, uid, [('model','=','res.partner'),('module','=','synchronize_google')])
|
|
||||||
assert data_ids, 'Addresses not created !'
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
Now I select from which group I want to get the contact details and I want to create partner for all contacts.
|
Now I select from which group I want to get the contact details and I want to create partner for all contacts.
|
||||||
-
|
-
|
||||||
!record {model: synchronize.google.import, id: synchronize_google_import_id1}:
|
!record {model: synchronize.google.import, id: synchronize_google_import_id1}:
|
||||||
create_partner: create_all
|
|
||||||
group_name: all
|
group_name: all
|
||||||
- |
|
- |
|
||||||
I import the contacts.
|
I import the contacts.
|
||||||
|
@ -33,4 +32,4 @@
|
||||||
address_ids = map(lambda x: x.res_id, [child for child in addr_obj.browse(cr, uid, data_ids) if child.res_id])
|
address_ids = map(lambda x: x.res_id, [child for child in addr_obj.browse(cr, uid, data_ids) if child.res_id])
|
||||||
partner_ids = map(lambda x: x.parent_id.id, [addr for addr in self.browse(cr, uid, address_ids) if addr.parent_id])
|
partner_ids = map(lambda x: x.parent_id.id, [addr for addr in self.browse(cr, uid, address_ids) if addr.parent_id])
|
||||||
assert partner_ids, 'Partners not created !'
|
assert partner_ids, 'Partners not created !'
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,6 @@ class synchronize_google(osv.osv_memory):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'create_partner': fields.selection([('create_all','Create partner for each contact'),('create_address','Import only address')],'Options'),
|
|
||||||
'customer': fields.boolean('Customer', help="Check this box to set newly created partner as Customer."),
|
'customer': fields.boolean('Customer', help="Check this box to set newly created partner as Customer."),
|
||||||
'supplier': fields.boolean('Supplier', help="Check this box to set newly created partner as Supplier."),
|
'supplier': fields.boolean('Supplier', help="Check this box to set newly created partner as Supplier."),
|
||||||
'group_name': fields.selection(_get_group, "Group Name",help="Choose which group to import, By default it takes all."),
|
'group_name': fields.selection(_get_group, "Group Name",help="Choose which group to import, By default it takes all."),
|
||||||
|
@ -110,7 +109,6 @@ class synchronize_google(osv.osv_memory):
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'create_partner': 'create_all',
|
|
||||||
'group_name': 'all',
|
'group_name': 'all',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,8 +136,7 @@ class synchronize_google(osv.osv_memory):
|
||||||
raise osv.except_osv(_('Error'), _("Please specify correct user and password !"))
|
raise osv.except_osv(_('Error'), _("Please specify correct user and password !"))
|
||||||
if obj.group_name not in ['all']:
|
if obj.group_name not in ['all']:
|
||||||
context.update({ 'group_name': obj.group_name})
|
context.update({ 'group_name': obj.group_name})
|
||||||
if obj.create_partner=='create_all':
|
tables.append('Contact')
|
||||||
tables.append('Contact')
|
|
||||||
else:
|
else:
|
||||||
tables.append('Address')
|
tables.append('Address')
|
||||||
context.update({'user': gmail_user,
|
context.update({'user': gmail_user,
|
||||||
|
|
|
@ -9,10 +9,8 @@
|
||||||
<form string="Import contacts from a google account">
|
<form string="Import contacts from a google account">
|
||||||
<group colspan="4" col="4" width="430">
|
<group colspan="4" col="4" width="430">
|
||||||
<field name="group_name" colspan="4"/>
|
<field name="group_name" colspan="4"/>
|
||||||
<separator string="Import Options" colspan="4"/>
|
|
||||||
<field name="create_partner" colspan="4"/>
|
|
||||||
<newline/>
|
<newline/>
|
||||||
<group attrs="{'invisible': [('create_partner','!=','create_all')]}" colspan="4" col="4">
|
<group colspan="4" col="4">
|
||||||
<separator string="Partner Status for this Group:" colspan="4"/>
|
<separator string="Partner Status for this Group:" colspan="4"/>
|
||||||
<field name="customer" colspan="4"/>
|
<field name="customer" colspan="4"/>
|
||||||
<field name="supplier" colspan="4"/>
|
<field name="supplier" colspan="4"/>
|
||||||
|
|
Loading…
Reference in New Issue