diff options
| author | DBR (OpenERP) <dbr@tinyerp.com> | 2011-06-13 19:04:53 +0530 |
|---|---|---|
| committer | DBR (OpenERP) <dbr@tinyerp.com> | 2011-06-13 19:04:53 +0530 |
| commit | a79f88db978e6ed779c1ef08907a8bea3b5e7a6c (patch) | |
| tree | 7278fcc2446412ea61b5b9235c6dc201358da569 /addons/import_google/wizard | |
| parent | a5f2c367bfb216f98641e5b4bbcec05b59a1de98 (diff) | |
[IMP]:Improve code for selected events
bzr revid: dbr@tinyerp.com-20110613133453-n2348lrgfb8939vz
Diffstat (limited to 'addons/import_google/wizard')
| -rw-r--r-- | addons/import_google/wizard/import_google_data.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/addons/import_google/wizard/import_google_data.py b/addons/import_google/wizard/import_google_data.py index d8bdd136002..8ffcfd92182 100644 --- a/addons/import_google/wizard/import_google_data.py +++ b/addons/import_google/wizard/import_google_data.py @@ -31,6 +31,7 @@ from osv import osv from tools.translate import _ from import_google import google_import + class google_login_contact(osv.osv_memory): _inherit = 'google.login' _name = 'google.login.contact' @@ -123,9 +124,13 @@ class synchronize_google(osv.osv_memory): gmail_user = user_obj.gmail_user gmail_pwd = user_obj.gmail_password google = self.pool.get('google.login') + if not gmail_user or not gmail_pwd: + raise osv.except_osv(_('Error'), _("Invalid login detail !\n Specify Username/Password.")) if context.get('contact'): gd_client = google.google_login(gmail_user, gmail_pwd, type='contact') + if not gd_client: + raise osv.except_osv(_('Error'), _("Please specify correct user and password !")) if obj.group_name not in ['all']: query = gdata.contacts.service.ContactsQuery() query.group = obj.group_name @@ -144,11 +149,13 @@ class synchronize_google(osv.osv_memory): elif context.get('calendar'): tables.append('Events') + current_rec = self.browse(cr, uid, ids, context=context) calendars = False - if obj.calendar_name != 'all': - calendars = [rec.calendar_name] - else: - calendars = map(lambda x: x[0], [cal for cal in self._get_calendars(cr, uid, context) if cal[0] != 'all']) + for rec in current_rec: + if rec.calendar_name != 'all': + calendars = [rec.calendar_name] + else: + calendars = map(lambda x: x[0], [cal for cal in self._get_calendars(cr, uid, context) if cal[0] != 'all']) context.update({'user': gmail_user, 'password': gmail_pwd, 'calendars': calendars, |
