[IMP] import_google : refectored code to use google_base_login
bzr revid: jam@tinyerp.com-20110608053250-z0cbv8bcobs5q10i
This commit is contained in:
parent
bd5e2f2661
commit
78fecbaa40
|
@ -280,7 +280,7 @@ synchronize_google_contact()
|
|||
class google_login_calendar(osv.osv_memory):
|
||||
"""Gdata Login Object for Google Calendar Import"""
|
||||
_inherit = 'google.login'
|
||||
_name = 'google.login.calendar'
|
||||
_name = 'google.login'
|
||||
|
||||
def _get_next_action(self, cr, uid, context):
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
|
@ -353,7 +353,7 @@ class synchronize_google_calendar_events(osv.osv_memory):
|
|||
context.update({'user': gmail_user,
|
||||
'password': gmail_pwd,
|
||||
'calendars': calendars,
|
||||
'events': True})
|
||||
'instance': 'calendar'})
|
||||
imp = import_contact(self, cr, uid, 'import_google', "import_google_calendar", [gmail_user], context)
|
||||
imp.set_table_list(table)
|
||||
imp.start()
|
||||
|
|
|
@ -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.calendar</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>
|
||||
|
|
|
@ -31,6 +31,7 @@ try:
|
|||
import gdata.contacts.service
|
||||
import gdata.calendar.service
|
||||
import gdata.contacts
|
||||
import gdata.calendar
|
||||
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'))
|
||||
from import_base.import_framework import *
|
||||
|
@ -45,9 +46,11 @@ class import_contact(import_framework):
|
|||
TABLE_EVENT = 'Events'
|
||||
|
||||
def initialize(self):
|
||||
if 'events' in self.context and self.context.get('events'):
|
||||
self.gd_client = gdata.calendar.service.CalendarService()
|
||||
self.gd_client.ClientLogin(self.context.get('user', False),self.context.get('password', False))
|
||||
google = self.obj.pool.get('google.login')
|
||||
self.gd_client = google.google_login(self.context.get('user'),
|
||||
self.context.get('password'),
|
||||
type = self.context.get('instance'))
|
||||
if self.context.get('instance') and self.context.get('instance') == 'calendar':
|
||||
self.calendars = self.context.get('calendars')
|
||||
|
||||
def get_mapping(self):
|
||||
|
|
Loading…
Reference in New Issue