← Back to team overview

openerp-dev-web team mailing list archive

lp:~openerp-dev/openobject-addons/trunk-contact-google-sync-backlog_validation_2011_05_10-uco into lp:~openerp-dev/openobject-addons/trunk-contact-google-sync

 

Ujjvala Collins (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-contact-google-sync-backlog_validation_2011_05_10-uco into lp:~openerp-dev/openobject-addons/trunk-contact-google-sync.

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

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

* In the wizard "CRM Application Configuration", 
* Add a selection box for Google sync under tilte "Synchronization" http://imageshack.us/f/857/googlesync.png/
* The page to connect should be like this http://imageshack.us/f/28/googlesync2.png/

* Address created should be type "Default"
* The responsible salesman (user_id) should be the connected user.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-contact-google-sync-backlog_validation_2011_05_10-uco/+merge/60593
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-contact-google-sync.
=== modified file 'crm/crm_installer.py'
--- crm/crm_installer.py	2011-01-14 00:11:01 +0000
+++ crm/crm_installer.py	2011-05-11 08:53:30 +0000
@@ -37,6 +37,7 @@
         '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."),
+        'import_google_contact': fields.boolean('Google Contacts', Help="It will import contacts from your google account."),
     }
 
     def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):

=== modified file 'crm/crm_installer_view.xml'
--- crm/crm_installer_view.xml	2011-01-14 00:11:01 +0000
+++ crm/crm_installer_view.xml	2011-05-11 08:53:30 +0000
@@ -19,7 +19,7 @@
             <attribute name="string">Enhance your core CRM Application with additional functionalities.</attribute>
           </xpath>
           <xpath expr='//separator[@string="vsep"]' position='attributes'>
-              <attribute name='rowspan'>13</attribute>
+              <attribute name='rowspan'>8</attribute>
               <attribute name='string'></attribute>
           </xpath>
           <xpath expr="//button[@string='Install Modules']" position="attributes">
@@ -37,6 +37,7 @@
                 <separator string="Synchronization" colspan="4" />
                 <field name="crm_caldav" />
                 <field name="fetchmail" />
+                <field name="import_google_contact"/>
             </group>
             <group colspan="2" col="2">
               <separator string="Plug-In" colspan="4" />

=== modified file 'google_base_account/wizard/google_login_view.xml'
--- google_base_account/wizard/google_login_view.xml	2011-03-07 13:33:54 +0000
+++ google_base_account/wizard/google_login_view.xml	2011-05-11 08:53:30 +0000
@@ -25,5 +25,18 @@
                 </form>
             </field>
         </record>
+        
+        <!-- 
+            Login Action 
+        -->
+        <record model="ir.actions.act_window" id="act_google_login_form">
+          <field name="name">Google Login</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="view_google_login_form" />
+        </record>
     </data>
 </openerp>

=== renamed directory 'sync_google_contact' => 'import_google_contact'
=== modified file 'import_google_contact/__init__.py'
--- sync_google_contact/__init__.py	2011-02-23 13:18:03 +0000
+++ import_google_contact/__init__.py	2011-05-11 08:53:30 +0000
@@ -19,8 +19,9 @@
 #
 ##############################################################################
 
-import sync_google_contact
+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'
--- sync_google_contact/__openerp__.py	2011-03-29 10:06:41 +0000
+++ import_google_contact/__openerp__.py	2011-05-11 08:53:30 +0000
@@ -30,6 +30,7 @@
     'depends': ['base','google_base_account'],
     'init_xml': [],
     'update_xml': [
+                  'import_google_contact_installer_view.xml',
                   'wizard/google_contact_import_view.xml'
                    ],
     'demo_xml': [],

=== renamed file 'sync_google_contact/sync_google_contact.py' => 'import_google_contact/import_google_contact.py'
=== added file 'import_google_contact/import_google_contact_installer.py'
--- import_google_contact/import_google_contact_installer.py	1970-01-01 00:00:00 +0000
+++ import_google_contact/import_google_contact_installer.py	2011-05-11 08:53:30 +0000
@@ -0,0 +1,59 @@
+# -*- 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()

=== added file 'import_google_contact/import_google_contact_installer_view.xml'
--- import_google_contact/import_google_contact_installer_view.xml	1970-01-01 00:00:00 +0000
+++ import_google_contact/import_google_contact_installer_view.xml	2011-05-11 08:53:30 +0000
@@ -0,0 +1,65 @@
+<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>

=== added directory 'import_google_contact/security'
=== added file 'import_google_contact/security/ir.model.access.csv'
--- import_google_contact/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ import_google_contact/security/ir.model.access.csv	2011-05-11 08:53:30 +0000
@@ -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

=== modified file 'import_google_contact/test/test_sync_google_contact_import_address.yml'
--- sync_google_contact/test/test_sync_google_contact_import_address.yml	2011-03-08 05:22:34 +0000
+++ import_google_contact/test/test_sync_google_contact_import_address.yml	2011-05-11 08:53:30 +0000
@@ -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.

=== modified file 'import_google_contact/test/test_sync_google_contact_import_partner.yml'
--- sync_google_contact/test/test_sync_google_contact_import_partner.yml	2011-03-08 05:22:34 +0000
+++ import_google_contact/test/test_sync_google_contact_import_partner.yml	2011-05-11 08:53:30 +0000
@@ -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.

=== modified file 'import_google_contact/wizard/google_contact_import.py'
--- sync_google_contact/wizard/google_contact_import.py	2011-04-01 09:32:24 +0000
+++ import_google_contact/wizard/google_contact_import.py	2011-05-11 08:53:30 +0000
@@ -35,31 +35,6 @@
 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'
 

=== modified file 'import_google_contact/wizard/google_contact_import_view.xml'
--- sync_google_contact/wizard/google_contact_import_view.xml	2011-03-21 09:21:36 +0000
+++ import_google_contact/wizard/google_contact_import_view.xml	2011-05-11 08:53:30 +0000
@@ -3,17 +3,20 @@
     <data>
         <record model="ir.ui.view" id="view_synchronize_google_contact_import_form">
             <field name="name">synchronize.base.form</field>
-            <field name="model">synchronize.base</field>
+            <field name="model">synchronize.google.contact.import</field>
             <field name="type">form</field>
             <field name="arch" type="xml">
                 <form string="Import contacts from a google account">
                     <group colspan="4" col="4" width="430">
-                       <field name="group_name" />
+                       <field name="group_name" colspan="4"/>
                        <separator string="Import Options" colspan="4"/>
-                       <field name="create_partner"/>
+                       <field name="create_partner" colspan="4"/>
                        <newline/>
-                       <group attrs="{'invisible': [('create_partner','!=','create_all')]}" colspan="2" col="4">
+                       <group attrs="{'invisible': [('create_partner','!=','create_all')]}" colspan="4" col="4">
+                            <separator string="Partner status for this group:"/>
                             <field name="customer"/>
+                            <newline/>
+                            <label string=""/>
                             <field name="supplier"/>
                        </group>
                     </group>
@@ -30,23 +33,20 @@
         </record>
         
         
-        <!-- 
-            Login Action 
-        -->
-        <record model="ir.actions.act_window" id="act_google_login_form">
+        <record model="ir.actions.act_window" id="act_import_google_contacts_form">
           <field name="name">Import Contacts</field>
           <field name="type">ir.actions.act_window</field>
-          <field name="res_model">google.login.contact</field>
+          <field name="res_model">synchronize.google.contact.import</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" />
+          <field name="view_id" ref="view_synchronize_google_contact_import_form" />
         </record>
 
 
         <menuitem id="menu_sync_contact"
                   parent="base.menu_address_book" 
-                  action="act_google_login_form"
+                  action="act_import_google_contacts_form"
                   sequence="40" />
     </data>
 </openerp>


Follow ups