← Back to team overview

openerp-dev-web team mailing list archive

lp:~openerp-dev/openobject-addons/trunk-calendar-import_event-uco into lp:~openerp-dev/openobject-addons/trunk-calendar

 

Ujjvala Collins (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-calendar-import_event-uco into lp:~openerp-dev/openobject-addons/trunk-calendar.

Requested reviews:
  OpenERP R&D Team (openerp-dev)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-calendar-import_event-uco/+merge/52645

Backlog 3 : Import event
--------------------------
* Wizard near meeting
* For login use the module google_base_account
* Choose which google calendar synchronize (there is more then one calendar per user)
  Can be all
* Each calendar in google calendar will create a meeting of different type
* Map the meeting in openerp with the meeting in google calendar with ir.model.data
* Merge if the meeting already exist : 
  the meeting already exist when the mapping in ir.model.data already exist
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-calendar-import_event-uco/+merge/52645
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/trunk-calendar-import_event-uco into lp:~openerp-dev/openobject-addons/trunk-calendar.
=== modified file 'crm/crm_lead.py'
--- crm/crm_lead.py	2011-03-04 12:53:34 +0000
+++ crm/crm_lead.py	2011-03-09 07:31:58 +0000
@@ -248,7 +248,6 @@
         data_obj = self.pool.get('ir.model.data')
         value = {}
 
-        view_id = False
 
         for case in self.browse(cr, uid, ids, context=context):
             context.update({'active_id': case.id})

=== modified file 'crm/wizard/crm_lead_to_partner.py'
--- crm/wizard/crm_lead_to_partner.py	2011-03-01 11:34:15 +0000
+++ crm/wizard/crm_lead_to_partner.py	2011-03-09 07:31:58 +0000
@@ -153,7 +153,6 @@
         contact_obj = self.pool.get('res.partner.address')
         partner_ids = []
         partner_id = False
-        contact_id = False
         rec_ids = context and context.get('active_ids', [])
 
         for data in self.browse(cr, uid, ids, context=context):
@@ -164,7 +163,7 @@
                         'user_id': lead.user_id.id,
                         'comment': lead.description,
                     })
-                    contact_id = contact_obj.create(cr, uid, {
+                    contact_obj.create(cr, uid, {
                         'partner_id': partner_id,
                         'name': lead.contact_name,
                         'phone': lead.phone,
@@ -184,7 +183,6 @@
                 else:
                     if data.partner_id:
                         partner_id = data.partner_id.id
-                        contact_id = partner_obj.address_get(cr, uid, [partner_id])['default']
                 self.assign_partner(cr, uid, lead.id, partner_id)
                 partner_ids.append(partner_id)
         return partner_ids
@@ -208,7 +206,7 @@
         if context is None:
             context = {}
 
-        partner_ids = self._create_partner(cr, uid, ids, context=context)
+        self._create_partner(cr, uid, ids, context=context)
         mod_obj = self.pool.get('ir.model.data')
         result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter')
         res = mod_obj.read(cr, uid, result, ['res_id'])

=== modified file 'crm/wizard/crm_merge_opportunities.py'
--- crm/wizard/crm_merge_opportunities.py	2011-02-24 15:03:09 +0000
+++ crm/wizard/crm_merge_opportunities.py	2011-03-09 07:31:58 +0000
@@ -45,7 +45,6 @@
 
     def get_attachments(self, cr, uid, id, context=None):
         attach_obj = self.pool.get('ir.attachment')
-        result = []
         attach_ids = attach_obj.search(cr, uid, [('res_model' , '=', 'crm.lead'), ('res_id', '=', id)])
         return attach_ids
 
@@ -116,7 +115,7 @@
             attach_ids = self.get_attachments(cr, uid, opp, context=context)
             self.set_attachements_res_id(cr, uid, first_opportunity.id, attach_ids)
             for history in opp.message_ids:
-                new_history = message_obj.copy(cr, uid, history.id, default={'res_id': opp.id})
+                message_obj.copy(cr, uid, history.id, default={'res_id': opp.id})
 
         #Notification about loss of information
         details = []
@@ -159,8 +158,6 @@
 
 
         # Get Opportunity views
-        result = models_data._get_id(
-            cr, uid, 'crm', 'view_crm_case_opportunities_filter')
         opportunity_view_form = models_data._get_id(
             cr, uid, 'crm', 'crm_case_form_view_oppor')
         opportunity_view_tree = models_data._get_id(

=== modified file 'crm_partner_assign/wizard/crm_forward_to_partner.py'
--- crm_partner_assign/wizard/crm_forward_to_partner.py	2011-02-24 15:03:09 +0000
+++ crm_partner_assign/wizard/crm_forward_to_partner.py	2011-03-09 07:31:58 +0000
@@ -20,11 +20,9 @@
 #
 ##############################################################################
 
-import base64
 import time
 import re
 from osv import osv, fields
-import tools
 from tools.translate import _
 
 class crm_lead_forward_to_partner(osv.osv_memory):

=== added directory 'google_base_account'
=== added file 'google_base_account/__init__.py'
--- google_base_account/__init__.py	1970-01-01 00:00:00 +0000
+++ google_base_account/__init__.py	2011-03-09 07:31:58 +0000
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 <http://www.gnu.org/licenses/>.     
+#
+##############################################################################
+
+import google_base_account
+import wizard
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'google_base_account/__openerp__.py'
--- google_base_account/__openerp__.py	1970-01-01 00:00:00 +0000
+++ google_base_account/__openerp__.py	2011-03-09 07:31:58 +0000
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+{
+    'name': 'Google user',
+    'version': '1.0',
+    'category': 'Generic Modules/Others',
+    'description': """The module adds google user  in res user""",
+    'author': 'OpenERP SA',
+    'website': 'http://www.openerp.com',
+    'depends': ['base'],
+    'init_xml': [],
+    'update_xml': [
+                  'google_base_account_view.xml',
+                  'wizard/google_login_view.xml',
+                   ],
+    'demo_xml': [],
+    'installable': True,
+    'active': False,
+    'certificate': '',
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'google_base_account/google_base_account.py'
--- google_base_account/google_base_account.py	1970-01-01 00:00:00 +0000
+++ google_base_account/google_base_account.py	2011-03-09 07:31:58 +0000
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields,osv
+    
+class res_users(osv.osv):
+    _inherit = "res.users"
+    _columns = {
+        'gmail_user': fields.char('Username', size=64,),
+        'gmail_password': fields.char('Password', size=64),
+    }
+res_users()    
+
+# vim:expandtab:smartindent:toabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'google_base_account/google_base_account_view.xml'
--- google_base_account/google_base_account_view.xml	1970-01-01 00:00:00 +0000
+++ google_base_account/google_base_account_view.xml	2011-03-09 07:31:58 +0000
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<openerp>
+    <data>
+		<record id="view_users_gogole_form" model="ir.ui.view">
+        <field name="name">res.users.google.form1</field>
+          <field name="model">res.users</field>
+          <field name="type">form</field>
+          <field name="inherit_id" ref="base.view_users_form"/>
+          <field name="arch" type="xml">
+              <xpath expr="//notebook[last()]" position="inside">
+                     <page string=" Synchronization ">
+                     	<separator string="Google Account" colspan="4" />
+						<field name="gmail_user"/>
+                      <field name="gmail_password" password="True"/>
+					</page>
+              </xpath>
+          </field>
+     </record>
+    </data>
+</openerp>

=== added directory 'google_base_account/wizard'
=== added file 'google_base_account/wizard/__init__.py'
--- google_base_account/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ google_base_account/wizard/__init__.py	2011-03-09 07:31:58 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 <http://www.gnu.org/licenses/>.     
+#
+##############################################################################
+
+import google_login
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'google_base_account/wizard/google_login.py'
--- google_base_account/wizard/google_login.py	1970-01-01 00:00:00 +0000
+++ google_base_account/wizard/google_login.py	2011-03-09 07:31:58 +0000
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+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_login(osv.osv_memory):
+    _description ='Google Contact'
+    _name = 'google.login'
+    _columns = {
+        'user': fields.char('Username', size=64, required=True),
+        'password': fields.char('Password', size=64),
+    }
+
+    def google_login(self,cr,uid,user,password,type='',context=None):
+        gd_client=False
+        if type == 'group': 
+            gd_client = gdata.contacts.client.ContactsClient(source='OpenERP')
+        if type == 'contact' :   
+            gd_client = gdata.contacts.service.ContactsService()
+        if type == 'calendar':
+            gd_client = gdata.calendar.service.CalendarService()
+        try:    
+            gd_client.ClientLogin(user, password,gd_client.source)
+        except Exception, e:
+            raise osv.except_osv(_('Error'), _(e))            
+        return gd_client
+
+
+    def default_get(self, cr, uid, fields, context=None):
+        res = super(google_login, self).default_get(cr, uid, fields, context=context)
+        user_obj = self.pool.get('res.users').browse(cr, uid, uid)
+        if 'user' in fields:
+            res.update({'user': user_obj.gmail_user})
+        if 'password' in fields:
+            res.update({'password': user_obj.gmail_password})
+        return res
+
+    def check_login(self, cr, uid, ids, context=None):
+        if context == None:
+            context = {}
+        data = self.read(cr, uid, ids)[0]
+        user = data['user']
+        password = data['password']
+        gd_client = gdata.contacts.service.ContactsService()
+        gd_client.email = user
+        gd_client.password = password
+        gd_client.source = 'OpenERP'
+        try:
+            gd_client.ProgrammaticLogin()
+            res = {
+                   'gmail_user': user,
+                   'gmail_password': password
+            }
+            self.pool.get('res.users').write(cr, uid, uid, res, context=context)
+        except :
+            raise osv.except_osv(_('Error'), _("Authentication fail check the user and password !"))
+
+        return self._get_next_action(cr, uid, context=context)
+
+    def _get_next_action(self, cr, uid, context=None):
+        return {'type': 'ir.actions.act_window_close'}
+
+google_login()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'google_base_account/wizard/google_login_view.xml'
--- google_base_account/wizard/google_login_view.xml	1970-01-01 00:00:00 +0000
+++ google_base_account/wizard/google_login_view.xml	2011-03-09 07:31:58 +0000
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<openerp>
+    <data>
+        <record model="ir.ui.view" id="view_google_login_form">
+            <field name="name">google.login.form</field>
+            <field name="model">google.login</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <form string="Google login" >
+                    <group colspan="4" col="4" width="300">
+                        <field name="user" />
+                        <newline/>
+                        <label string="ex: user@xxxxxxxxx" align="1.0" colspan="2"/>
+                        <newline/>
+                        <field name="password" password="True"/>
+                    </group>
+                    <separator string="" colspan="4"/>
+                    <group colspan="4" col="4">
+                        <group colspan="2"/>
+                        <group colspan="2">  
+                            <button special="cancel" string="_Cancel" icon="gtk-cancel"/>
+                            <button name="check_login" string="_Login" type="object" icon="terp-check"/>
+                        </group>
+                    </group>
+                </form>
+            </field>
+        </record>
+    </data>
+</openerp>

=== added directory 'sync_google_calendar'
=== added file 'sync_google_calendar/__init__.py'
--- sync_google_calendar/__init__.py	1970-01-01 00:00:00 +0000
+++ sync_google_calendar/__init__.py	2011-03-09 07:31:58 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 <http://www.gnu.org/licenses/>.     
+#
+##############################################################################
+
+import wizard
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'sync_google_calendar/__openerp__.py'
--- sync_google_calendar/__openerp__.py	1970-01-01 00:00:00 +0000
+++ sync_google_calendar/__openerp__.py	2011-03-09 07:31:58 +0000
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+{
+    'name': 'Google Calendar',
+    'version': '1.0',
+    'category': 'Generic Modules/Others',
+    'description': """The module adds google calendar events to meetings.""",
+    'author': 'OpenERP SA',
+    'website': 'http://www.openerp.com',
+    'depends': ['base','google_base_account', 'crm'],
+    'init_xml': [],
+    'update_xml': ['wizard/wizard_import_calendar_events_view.xml'],
+    'demo_xml': [],
+    'installable': True,
+    'active': False,
+    'certificate': '',
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added directory 'sync_google_calendar/wizard'
=== added file 'sync_google_calendar/wizard/__init__.py'
--- sync_google_calendar/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ sync_google_calendar/wizard/__init__.py	2011-03-09 07:31:58 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 <http://www.gnu.org/licenses/>.     
+#
+##############################################################################
+
+import wizard_import_calendar_events
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'sync_google_calendar/wizard/wizard_import_calendar_events.py'
--- sync_google_calendar/wizard/wizard_import_calendar_events.py	1970-01-01 00:00:00 +0000
+++ sync_google_calendar/wizard/wizard_import_calendar_events.py	2011-03-09 07:31:58 +0000
@@ -0,0 +1,164 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 <http://www.gnu.org/licenses/>.     
+#
+##############################################################################
+
+from osv import fields,osv
+from tools.translate import _
+import tools
+
+import time
+import datetime
+import dateutil
+from dateutil.tz import *
+from dateutil.parser import *
+
+import urllib
+
+try:
+    import gdata
+    import gdata.calendar.service
+    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'))
+
+def _get_tinydates(self, stime, etime):
+    stime = dateutil.parser.parse(stime)
+    etime = dateutil.parser.parse(etime)
+    try:
+        au_dt = au_tz.normalize(stime.astimezone(au_tz))
+        timestring = datetime.datetime(*au_dt.timetuple()[:6]).strftime('%Y-%m-%d %H:%M:%S')
+        au_dt = au_tz.normalize(etime.astimezone(au_tz))
+        timestring_end = datetime.datetime(*au_dt.timetuple()[:6]).strftime('%Y-%m-%d %H:%M:%S')
+    except:
+        timestring = datetime.datetime(*stime.timetuple()[:6]).strftime('%Y-%m-%d %H:%M:%S')
+        timestring_end = datetime.datetime(*etime.timetuple()[:6]).strftime('%Y-%m-%d %H:%M:%S')
+    return (timestring, timestring_end)
+
+class google_login(osv.osv_memory):
+    _inherit = 'google.login'
+    _name = 'google.login'
+
+    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_calendar', 'view_synchronize_google_calendar_import_form')
+        view_id = False
+        if data_id:
+            view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
+        value = {
+            'name': _('Import Events'),
+            'view_type': 'form',
+            'view_mode': 'form,tree',
+            'res_model': 'synchronize.google.calendar',
+            'view_id': False,
+            'context': context,
+            'views': [(view_id, 'form')],
+            'type': 'ir.actions.act_window',
+            'target': 'new',
+        }
+        return value
+
+google_login()
+
+class synchronize_google_calendar_events(osv.osv_memory):
+    _name = 'synchronize.google.calendar'
+    
+    def _get_calendars(self, cr, uid, context=None):
+        user_obj = self.pool.get('res.users').browse(cr, uid, uid)
+        google = self.pool.get('google.login')
+        res = []
+        gd_client = google.google_login(cr, uid, user_obj.gmail_user, user_obj.gmail_password, type='calendar')
+        calendars = gd_client.GetAllCalendarsFeed()
+        for cal in calendars.entry:
+            res.append((cal.id.text, cal.title.text))
+        res.append(('default','Default Calendar'))
+        return res
+    
+    _columns = {
+        'calendar_name': fields.selection(_get_calendars, "Calendar Name", size=32),
+    }
+    
+    _defaults = {
+        'calendar_name': 'default',
+    }
+    
+    def import_calendar_events(self, cr, uid, ids, context=None):
+        obj = self.browse(cr, uid, ids, context=context)[0]
+        if not ids:
+            return { 'type': 'ir.actions.act_window_close' }
+
+        user_obj = self.pool.get('res.users').browse(cr, uid, uid)
+        meeting_obj = self.pool.get('crm.meeting')
+        model_obj = self.pool.get('ir.model.data')
+        gmail_user = user_obj.gmail_user
+        gamil_pwd = user_obj.gmail_password
+        
+        google = self.pool.get('google.login')
+        gd_client = google.google_login(cr, uid, gmail_user, gamil_pwd, type='calendar')
+
+        if not gmail_user or not gamil_pwd:
+            raise osv.except_osv(_('Error'), _("Please specify the user and password !"))
+        
+        if obj.calendar_name != 'default':
+            events_query = gdata.calendar.service.CalendarEventQuery(user=urllib.unquote(obj.calendar_name.split('/')[~0]))
+            events_query.start_index = 1
+            events_query.max_results = 1000
+            event_feed = gd_client.GetCalendarEventFeed(events_query.ToUri())
+        else:
+            event_feed = gd_client.GetCalendarEventFeed()
+
+        meeting_ids = []
+        for feed in event_feed.entry:
+            google_id = feed.id.text
+            model_data = {
+                'name': google_id,
+                'model': 'crm.meeting',
+                'module': 'sync_google_calendar',
+            }
+            vals = {
+                'name': feed.title.text,
+                'description': feed.content.text,
+            }
+            timestring, timestring_end = _get_tinydates(self, feed.when[0].start_time, feed.when[0].end_time)
+            vals.update({'date': timestring, 'date_deadline': timestring_end})
+            data_ids = model_obj.search(cr, uid, [('model','=','crm.meeting'), ('name','=',google_id)])
+            if data_ids:
+                meeting_ids.append(model_obj.browse(cr, uid, data_ids[0], context=context).res_id)
+                meeting_obj.write(cr, uid, meeting_ids, vals, context=context)
+            else:
+                res_id = meeting_obj.create(cr, uid, vals, context=context)
+                meeting_ids.append(res_id)
+                model_data.update({'res_id': res_id})
+                model_obj.create(cr, uid, model_data, context=context)
+        
+        return {
+            'name': _('Meetings'),
+            'domain': "[('id','in', ["+','.join(map(str,meeting_ids))+"])]",
+            'view_type': 'form',
+            'view_mode': 'tree,form',
+            'res_model': 'crm.meeting',
+            'context': context,
+            'views': [(False, 'calendar'),(False, 'tree'),(False, 'form')],
+            'type': 'ir.actions.act_window',
+        }
+    
+synchronize_google_calendar_events()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'sync_google_calendar/wizard/wizard_import_calendar_events_view.xml'
--- sync_google_calendar/wizard/wizard_import_calendar_events_view.xml	1970-01-01 00:00:00 +0000
+++ sync_google_calendar/wizard/wizard_import_calendar_events_view.xml	2011-03-09 07:31:58 +0000
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<openerp>
+    <data>
+        <record model="ir.ui.view" id="view_synchronize_google_calendar_import_form">
+            <field name="name">synchronize.google.calendar.form</field>
+            <field name="model">synchronize.google.calendar</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <form string="Import Google Calendar Events">
+                    <group colspan="4" col="4">
+                       <field name="calendar_name" />
+                    </group>
+                    <separator string="" colspan="4"/>
+                    <group colspan="4" col="4">
+                        <group colspan="2" col="2"/>
+                        <group colspan="2" col="2">
+                            <button special="cancel" string="_Cancel" icon="gtk-cancel"/>
+                            <button name="import_calendar_events" string="_Import Events" type="object" icon="terp-calendar"/>
+                        </group>
+                    </group>
+                </form>
+            </field>
+        </record>
+        
+        
+        <!-- 
+            Login Action 
+        -->
+        <record model="ir.actions.act_window" id="act_google_login_form">
+          <field name="name">Import google calendar events</field>
+          <field name="type">ir.actions.act_window</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>
+          <field name="view_id" ref="google_base_account.view_google_login_form" />
+        </record>
+
+
+        <menuitem id="menu_sync_contact"
+                  parent="crm.menu_meeting_sale" 
+                  action="act_google_login_form"
+                  sequence="20" />
+    </data>
+</openerp>


Follow ups