← Back to team overview

openerp-dev-web team mailing list archive

lp:~openerp-dev/openobject-addons/trunk-contact-google-sync-backlog_correction-dbr into lp:~openerp-dev/openobject-addons/trunk-contact-google-sync

 

Jigar Amin - OpenERP has proposed merging lp:~openerp-dev/openobject-addons/trunk-contact-google-sync-backlog_correction-dbr into lp:~openerp-dev/openobject-addons/trunk-contact-google-sync.

Requested reviews:
  Bhumika (OpenERP) (sbh-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-contact-google-sync-backlog_correction-dbr/+merge/62853

Changes :
  Backlog Validation import google contact
Kindly Review this
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-contact-google-sync-backlog_correction-dbr/+merge/62853
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-contact-google-sync.
=== modified file 'import_google_contact/__init__.py'
--- import_google_contact/__init__.py	2011-05-10 13:29:01 +0000
+++ import_google_contact/__init__.py	2011-05-30 09:49:25 +0000
@@ -21,7 +21,5 @@
 
 import import_google_contact
 import wizard
-import import_google_contact_installer
-
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 

=== modified file 'import_google_contact/__openerp__.py'
--- import_google_contact/__openerp__.py	2011-05-10 13:29:01 +0000
+++ import_google_contact/__openerp__.py	2011-05-30 09:49:25 +0000
@@ -30,7 +30,6 @@
     'depends': ['base','google_base_account'],
     'init_xml': [],
     'update_xml': [
-                  'import_google_contact_installer_view.xml',
                   'wizard/google_contact_import_view.xml'
                    ],
     'demo_xml': [],

=== removed file 'import_google_contact/import_google_contact_installer.py'
--- import_google_contact/import_google_contact_installer.py	2011-05-10 13:29:01 +0000
+++ import_google_contact/import_google_contact_installer.py	1970-01-01 00:00:00 +0000
@@ -1,59 +0,0 @@
-# -*- 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_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 self.action_next(cr, uid, ids, context=context)
-	
-google_installer_crm()

=== removed file 'import_google_contact/import_google_contact_installer_view.xml'
--- import_google_contact/import_google_contact_installer_view.xml	2011-05-10 13:29:01 +0000
+++ import_google_contact/import_google_contact_installer_view.xml	1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
-<openerp>
-  <data>
-    <record id="view_crm_inherit_id" model="ir.ui.view">
-      <field name="name">Google From</field>
-      <field name="model">google.installer.crm</field>
-      <field name="type">form</field>
-      <field name="inherit_id" ref="base.res_config_installer"/>
-      <field name="arch" type="xml">
-        
-          <form position="attributes">
-            <attribute name="string">Import your contacts from Google</attribute>
-          </form>
-		 <separator string="title" position="attributes">
-            <attribute name="string">Enter Your Google Connection Data</attribute>
-          </separator>
-		<xpath expr="//label[@string='description']" position="attributes">
-            <attribute name="string">Enter your Google login and password. It will give you the possibility to import and synchronize your Gmail contacts.</attribute>
-        </xpath>
-
-		 
-        <xpath expr="//button[@string='Install Modules']" position="replace">
-            <button name="login" icon="gtk-go-forward" type="object" string="Configure" colspan="1"/>
-        </xpath>
-
-        <xpath expr="//button[@string='Skip']" position="replace">
-                <button name="action_skip" icon="gtk-jump-to" special="cancel" type="object" string="Skip" colspan="1" invisible="context.get('menu',False)"/>
-        </xpath>
-
-		<xpath expr='//separator[@string="vsep"]' position='attributes'>
-		  		<attribute name='string'></attribute>
-		  		<attribute name='rowspan'>5</attribute>
-		</xpath>
- 			 	<group colspan="8" position="replace">
-             	 <group colspan="8" height="50" width="350">
-                     <field name="user"/>
-                        <newline/>
-                        <label string="ex: usr@xxxxxxxxx" align="1.0" colspan="2"/>
-                        <newline/>
-                        <field name="password" password="True"/>
-                  </group>
-              </group>
-            </field>
-	 </record>
-
-   
-
-	<record id="act_google_installer" model="ir.actions.act_window">
-      <field name="name">Google Login View</field>
-      <field name="type">ir.actions.act_window</field>
-      <field name="res_model">google.installer.crm</field>
-      <field name="view_id" ref="view_crm_inherit_id"/>
-      <field name="view_type">form</field>
-      <field name="view_mode">form</field>
-      <field name="target">new</field>
-    </record>
-
-	<record id="google_installer_todo" model="ir.actions.todo">
-        <field name="action_id" ref="act_google_installer"/>
-        <field name="restart">always</field>
-        <field name="sequence">3</field>
-		<field eval="[(6,0,[ref('base.group_extended')])]" name="groups_id"/>
-	</record>
-
-	</data>
-</openerp>

=== modified file 'import_google_contact/wizard/google_contact_import.py'
--- import_google_contact/wizard/google_contact_import.py	2011-05-27 09:49:46 +0000
+++ import_google_contact/wizard/google_contact_import.py	2011-05-30 09:49:25 +0000
@@ -34,6 +34,29 @@
 from tools.translate import _
 import tools
 
+class google_login_contact(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, 'import_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_login_contact()
+
 class synchronize_google_contact(osv.osv_memory):
     _name = 'synchronize.google.contact.import'
 
@@ -45,7 +68,7 @@
         gd_client = google.google_login(user_obj.gmail_user,user_obj.gmail_password,type='group')
         if not gd_client:
             raise osv.except_osv(_('Error'), _("Authentication fail check the user and password !"))
-        
+
         res = []
         query = gdata.contacts.service.GroupsQuery(feed='/m8/feeds/groups/default/full')
         if gd_client:
@@ -82,7 +105,7 @@
                                                   'supplier': data.get('supplier', False)
                                         }, context=context)
         return partner_id
-    
+
     def set_partner(self, cr, uid, name, address_id, context=None):
         partner_pool = self.pool.get('res.partner')
         partner_ids = partner_pool.search(cr, uid, [('name', '=', name)], context=context)
@@ -188,7 +211,7 @@
                             partner_ids.append(partner_id)
                     addresses.append(res_id)
 
-                if not data_ids: #link to google_id if it was not the case before            
+                if not data_ids: #link to google_id if it was not the case before
                     model_data.update({'res_id': res_id})
                     model_obj.create(cr, uid, model_data, context=context)
 
@@ -199,7 +222,7 @@
             return partner_ids
         else:
             return addresses
-        
+
     def _retreive_data(self, entry):
         data = {}
         data['id'] = entry.id.text
@@ -242,7 +265,7 @@
             vals['phone'] = data.get('phone','')
         if addr.fax != data.get('fax'):
             vals['fax'] = data.get('fax','')
-        
+
         addresss_obj.write(cr, uid, contact_ids, vals, context=context)
         return {'type': 'ir.actions.act_window_close'}
 

=== modified file 'import_google_contact/wizard/google_contact_import_view.xml'
--- import_google_contact/wizard/google_contact_import_view.xml	2011-05-12 09:18:23 +0000
+++ import_google_contact/wizard/google_contact_import_view.xml	2011-05-30 09:49:25 +0000
@@ -30,20 +30,19 @@
             </field>
         </record>
 
-        <record model="ir.actions.act_window" id="act_import_google_contacts_form">
+        <record model="ir.actions.act_window" id="act_google_login_contact_form">
           <field name="name">Import Contacts</field>
           <field name="type">ir.actions.act_window</field>
-          <field name="res_model">synchronize.google.contact.import</field>
+          <field name="res_model">google.login.contact</field>
           <field name="view_type">form</field>
           <field name="view_mode">form</field>
           <field name="target">new</field>
-          <field name="view_id" ref="view_synchronize_google_contact_import_form" />
+          <field name="view_id" ref="google_base_account.view_google_login_form" />
         </record>
 
-
         <menuitem id="menu_sync_contact"
                   parent="base.menu_address_book"
-                  action="act_import_google_contacts_form"
+                  action="act_google_login_contact_form"
                   sequence="40" />
     </data>
 </openerp>


Follow ups