diff --git a/addons/crm/crm_installer.py b/addons/crm/crm_installer.py
index 32551d438c4..9e62d51a2a5 100644
--- a/addons/crm/crm_installer.py
+++ b/addons/crm/crm_installer.py
@@ -37,6 +37,7 @@ class crm_installer(osv.osv_memory):
'thunderbird': fields.boolean('Thunderbird', help="Allows you to link your e-mail to OpenERP's documents. You can attach it to any existing one in OpenERP or create a new one."),
'outlook': fields.boolean('MS-Outlook', help="Allows you to link your e-mail to OpenERP's documents. You can attach it to any existing one in OpenERP or create a new one."),
'wiki_sale_faq': fields.boolean('Sale FAQ', help="Helps you manage wiki pages for Frequently Asked Questions on Sales Application."),
+ 'sync_google_contact': fields.boolean('Google Contacts'),
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
diff --git a/addons/crm/crm_installer_view.xml b/addons/crm/crm_installer_view.xml
index 35ff5a0a7cc..ae9dc5026e6 100644
--- a/addons/crm/crm_installer_view.xml
+++ b/addons/crm/crm_installer_view.xml
@@ -37,6 +37,7 @@
+
diff --git a/addons/google_base_account/wizard/google_login_view.xml b/addons/google_base_account/wizard/google_login_view.xml
index 653cf41d211..9c5c93c613e 100644
--- a/addons/google_base_account/wizard/google_login_view.xml
+++ b/addons/google_base_account/wizard/google_login_view.xml
@@ -25,5 +25,18 @@
+
+
+
+ Google Login
+ ir.actions.act_window
+ google.login
+ form
+ form
+ new
+
+
diff --git a/addons/sync_google_contact/__init__.py b/addons/sync_google_contact/__init__.py
index 202f8f989f2..01ccebf7811 100644
--- a/addons/sync_google_contact/__init__.py
+++ b/addons/sync_google_contact/__init__.py
@@ -21,6 +21,7 @@
import sync_google_contact
import wizard
+import google_login_installer
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/sync_google_contact/__openerp__.py b/addons/sync_google_contact/__openerp__.py
index 6d19f2c6865..4f1eaf7d42d 100644
--- a/addons/sync_google_contact/__openerp__.py
+++ b/addons/sync_google_contact/__openerp__.py
@@ -30,6 +30,7 @@
'depends': ['base','google_base_account'],
'init_xml': [],
'update_xml': [
+ 'google_login_installer.xml',
'wizard/google_contact_import_view.xml'
],
'demo_xml': [],
diff --git a/addons/sync_google_contact/google_login_installer.py b/addons/sync_google_contact/google_login_installer.py
new file mode 100644
index 00000000000..8ae52f34d9c
--- /dev/null
+++ b/addons/sync_google_contact/google_login_installer.py
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from osv import fields, osv
+from tools.translate import _
+try:
+ import gdata.contacts.service
+except ImportError:
+ raise osv.except_osv(_('Google Contacts Import Error!'), _('Please install gdata-python-client from http://code.google.com/p/gdata-python-client/downloads/list'))
+
+class google_installer_crm(osv.osv_memory):
+ _name = 'google.installer.crm'
+ _inherit = 'res.config.installer'
+ _columns = {
+ 'user': fields.char('Google Username', size=64, required=True),
+ 'password': fields.char('Google Password', size=64)
+ }
+
+ def google_login(self, user, password, type='group', context=None):
+ gd_client = gdata.contacts.service.ContactsService()
+ try:
+ gd_client.ClientLogin(user, password,gd_client.source)
+ except Exception:
+ return False
+ return gd_client
+
+ def login(self, cr, uid, ids, context=None):
+ data = self.read(cr, uid, ids)[0]
+ user = data['user']
+ password = data['password']
+ if self.google_login(user, password):
+ res = {
+ 'gmail_user': user,
+ 'gmail_password': password
+ }
+ self.pool.get('res.users').write(cr, uid, uid, res, context=context)
+ else:
+ raise osv.except_osv(_('Error'), _("Authentication failed! Check the user and password !"))
+ return {}
+
+google_installer_crm()
diff --git a/addons/sync_google_contact/google_login_installer.xml b/addons/sync_google_contact/google_login_installer.xml
new file mode 100644
index 00000000000..28f9d31fada
--- /dev/null
+++ b/addons/sync_google_contact/google_login_installer.xml
@@ -0,0 +1,65 @@
+
+
+
+ Google From
+ google.installer.crm
+ form
+
+
+
+
+
+ Enter Your Google Connection Data
+
+
+ Enter your Google login and password. It will give you the possibility to import and synchronize your Gmail contacts.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Google Login View
+ ir.actions.act_window
+ google.installer.crm
+
+ form
+ form
+ new
+
+
+
+
+ always
+ 3
+
+
+
+
+
diff --git a/addons/sync_google_contact/security/ir.model.access.csv b/addons/sync_google_contact/security/ir.model.access.csv
new file mode 100644
index 00000000000..448a593965b
--- /dev/null
+++ b/addons/sync_google_contact/security/ir.model.access.csv
@@ -0,0 +1,3 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_res_users_partner_manager","google.res.partner.manager","base.model_ir_model_data","base.group_partner_manager",1,1,1,0
+"access_ir_model_data_partner_manager","ir.model.data.partner.manager","base.model_res_users","base.group_partner_manager",1,1,0,0
\ No newline at end of file
diff --git a/addons/sync_google_contact/test/test_sync_google_contact_import_address.yml b/addons/sync_google_contact/test/test_sync_google_contact_import_address.yml
index e330764dff5..79db352db21 100644
--- a/addons/sync_google_contact/test/test_sync_google_contact_import_address.yml
+++ b/addons/sync_google_contact/test/test_sync_google_contact_import_address.yml
@@ -4,13 +4,13 @@
- |
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_contact_id0}:
user: testmail.openerp
password: openerptiny
- |
I login into that account.
-
- !python {model: google.login.contact}: |
+ !python {model: google.login}: |
self.login(cr, uid, [ref('google_login_contact_id0')], context)
- |
Now I select from which group I want to get the contact details.
diff --git a/addons/sync_google_contact/test/test_sync_google_contact_import_partner.yml b/addons/sync_google_contact/test/test_sync_google_contact_import_partner.yml
index bfe01943c7f..95db4de043e 100644
--- a/addons/sync_google_contact/test/test_sync_google_contact_import_partner.yml
+++ b/addons/sync_google_contact/test/test_sync_google_contact_import_partner.yml
@@ -4,13 +4,13 @@
- |
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_contact_id1}:
user: testmail.openerp
password: openerptiny
- |
I login into that account.
-
- !python {model: google.login.contact}: |
+ !python {model: google.login}: |
self.login(cr, uid, [ref('google_login_contact_id1')], context)
- |
Now I select from which group I want to get the contact details and I want to create partner for all contacts.
diff --git a/addons/sync_google_contact/wizard/google_contact_import.py b/addons/sync_google_contact/wizard/google_contact_import.py
index 31747421c88..41fce2cb049 100644
--- a/addons/sync_google_contact/wizard/google_contact_import.py
+++ b/addons/sync_google_contact/wizard/google_contact_import.py
@@ -35,31 +35,6 @@ from osv import fields,osv
from tools.translate import _
import tools
-class google_contact_import(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')
- data_id = data_obj._get_id(cr, uid, 'sync_google_contact', 'view_synchronize_google_contact_import_form')
- view_id = False
- if data_id:
- view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
- value = {
- 'name': _('Import Contact'),
- 'view_type': 'form',
- 'view_mode': 'form,tree',
- 'res_model': 'synchronize.google.contact.import',
- 'view_id': False,
- 'context': context,
- 'views': [(view_id, 'form')],
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- }
- return value
-
-google_contact_import()
-
class synchronize_google_contact(osv.osv_memory):
_name = 'synchronize.google.contact.import'
diff --git a/addons/sync_google_contact/wizard/google_contact_import_view.xml b/addons/sync_google_contact/wizard/google_contact_import_view.xml
index 999c953224d..9a1bd905abe 100644
--- a/addons/sync_google_contact/wizard/google_contact_import_view.xml
+++ b/addons/sync_google_contact/wizard/google_contact_import_view.xml
@@ -3,17 +3,23 @@
synchronize.base.form
- synchronize.base
+ synchronize.google.contact.importform
-
-
+ Import Contactsir.actions.act_window
- google.login.contact
+ synchronize.google.contact.importformformnew
-
+