openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #03523
lp:~openerp-dev/openobject-addons/trunk-contact-google-sync-improve_wizard-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-improve_wizard-uco into lp:~openerp-dev/openobject-addons/trunk-contact-google-sync.
Requested reviews:
OpenERP R&D Team (openerp-dev)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-contact-google-sync-improve_wizard-uco/+merge/51529
Backlog correction
--------------------
* In res.user synchro tab replace "user name" into google account
* Rename the "synchronize" buton into Import
* Remove the module base_sync
* Change title of the wizart : Import Contacts from your google Account
* User Name -> change into Username
* Second wizard : change the part "do you want to create partner :
Section with the tilte : Import options
Inside, put a selection box with 2 propositions instead of the checkbox :
create a partner for each contact
import only an address
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-contact-google-sync-improve_wizard-uco/+merge/51529
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/trunk-contact-google-sync-improve_wizard-uco into lp:~openerp-dev/openobject-addons/trunk-contact-google-sync.
=== modified file 'google_base_account/google_base_account.py'
--- google_base_account/google_base_account.py 2011-02-23 13:18:03 +0000
+++ google_base_account/google_base_account.py 2011-02-28 12:46:20 +0000
@@ -19,12 +19,12 @@
#
##############################################################################
-from osv import fields,osv,orm
+from osv import fields,osv
class res_users(osv.osv):
_inherit = "res.users"
_columns = {
- 'gmail_user': fields.char('User Name', size=64,),
+ 'gmail_user': fields.char('Google Account', size=64,),
'gmail_password': fields.char('Password', size=64),
}
res_users()
=== modified file 'google_base_account/wizard/google_login.py'
--- google_base_account/wizard/google_login.py 2011-02-24 13:33:42 +0000
+++ google_base_account/wizard/google_login.py 2011-02-28 12:46:20 +0000
@@ -30,7 +30,7 @@
_description ='Google Contact'
_name = 'google.login'
_columns = {
- 'user': fields.char('User Name', size=64, required=True),
+ 'user': fields.char('Username', size=64, required=True),
'password': fields.char('Password', size=64),
}
@@ -74,7 +74,7 @@
}
self.pool.get('res.users').write(cr, uid, uid, res, context=context)
except :
- raise osv.except_osv(_('Error'), _("Authication fail check the user and password !"))
+ raise osv.except_osv(_('Error'), _("Authentication fail check the user and password !"))
return self._get_next_action(cr, uid, context=context)
=== removed directory 'sync_base'
=== removed file 'sync_base/__init__.py'
--- sync_base/__init__.py 2011-02-14 07:33:46 +0000
+++ sync_base/__init__.py 1970-01-01 00:00:00 +0000
@@ -1,25 +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/>.
-#
-##############################################################################
-
-import sync_base
-import wizard
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
=== removed file 'sync_base/__openerp__.py'
--- sync_base/__openerp__.py 2011-02-21 17:29:35 +0000
+++ sync_base/__openerp__.py 1970-01-01 00:00:00 +0000
@@ -1,40 +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/>.
-#
-##############################################################################
-
-
-{
- 'name': 'Google Contact',
- 'version': '1.0',
- 'category': 'Generic Modules/Others',
- 'description': """The module adds synchronization with multiple app """,
- 'author': 'OpenERP SA',
- 'website': 'http://www.openerp.com',
- 'depends': ['base'],
- 'init_xml': [],
- 'update_xml': [
- 'wizard/sync_base_view.xml'
- ],
- 'demo_xml': [],
- 'installable': True,
- 'active': False,
- 'certificate': '',
-}
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== removed directory 'sync_base/wizard'
=== removed file 'sync_base/wizard/__init__.py'
--- sync_base/wizard/__init__.py 2011-02-14 07:20:49 +0000
+++ sync_base/wizard/__init__.py 1970-01-01 00:00:00 +0000
@@ -1,24 +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/>.
-#
-##############################################################################
-
-import synchronize_base
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== removed file 'sync_base/wizard/sync_base_view.xml'
--- sync_base/wizard/sync_base_view.xml 2011-02-25 09:22:40 +0000
+++ sync_base/wizard/sync_base_view.xml 1970-01-01 00:00:00 +0000
@@ -1,40 +0,0 @@
-<?xml version="1.0"?>
-<openerp>
- <data>
- <record model="ir.ui.view" id="sync_base_import_wizard_view">
- <field name="name">Synchronize contact</field>
- <field name="model">synchronize.base.contact.wizard.import</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Import contact from external adress book">
- <field name="tools"/>
- <newline />
- <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="action_synchronize" string="_Synchronize" type="object" icon="terp-check"/>
- </group>
- </group>
- </form>
- </field>
- </record>
-
- <record model="ir.actions.act_window" id="act_google_contact_import_form">
- <field name="name">Import contacts from remote address book</field>
- <field name="type">ir.actions.act_window</field>
- <field name="res_model">synchronize.base.contact.wizard.import</field>
- <field name="view_type">form</field>
- <field name="view_mode">form</field>
- <field name="target">new</field>
- <field name="view_id" ref="sync_base_import_wizard_view" />
- </record>
-
-
- <menuitem name="Import contacts from remote address book" id="menu_sync_contact"
- parent="base.menu_address_book" action="act_google_contact_import_form"
- sequence="40" />
-
- </data>
-</openerp>
=== removed file 'sync_base/wizard/synchronize_base.py'
--- sync_base/wizard/synchronize_base.py 2011-02-25 10:53:05 +0000
+++ sync_base/wizard/synchronize_base.py 1970-01-01 00:00:00 +0000
@@ -1,61 +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 _
-
-
-class synchronize_base(osv.osv_memory):
- _description ='Synchronize base import contact '
- _name = "synchronize.base.contact.wizard.import"
-
- def _get_tools_name(self, cr, user, context):
- """
- @return the list of value of the selection field
- should be overwritten by subclasses
- """
- return []
-
- _columns = {
- 'tools': fields.selection(_get_tools_name, 'App to synchronize with'),
- }
-
-
- def action_synchronize(self, cr, uid, ids, context=None):
- wizard_data = self.browse(cr, uid, ids, context=context)
- return self._get_action(cr, uid, wizard_data[0].tools, context=context)
-
-
- def _get_action(self, cr, uid, tools, context=None):
- if not tools:
- raise osv.except_osv(_("Error !"),_("Select App to synchronize with."))
- return self._get_actions_dic(cr, uid, context=context)[tools]
-
- def _get_actions_dic(self, cr, uid, context=None):
- """
- this method should be overwritten in specialize module
- @return the dictonnaries of action
- """
- return {'none' : {'type': 'ir.actions.act_window_close' }}
-
-synchronize_base()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'sync_google_contact/__openerp__.py'
--- sync_google_contact/__openerp__.py 2011-02-17 11:28:36 +0000
+++ sync_google_contact/__openerp__.py 2011-02-28 12:46:20 +0000
@@ -24,10 +24,10 @@
'name': 'Google Contact',
'version': '1.0',
'category': 'Generic Modules/Others',
- 'description': """The module adds google contact in partner address""",
+ 'description': """The module adds google contact in partner address""",
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
- 'depends': ['base','google_base_account','sync_base'],
+ 'depends': ['base','google_base_account'],
'init_xml': [],
'update_xml': [
'wizard/google_contact_import_view.xml'
=== modified file 'sync_google_contact/wizard/google_contact_import.py'
--- sync_google_contact/wizard/google_contact_import.py 2011-02-25 09:37:17 +0000
+++ sync_google_contact/wizard/google_contact_import.py 2011-02-28 12:46:20 +0000
@@ -30,53 +30,6 @@
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_base_import(osv.osv_memory):
- _inherit = 'synchronize.base.contact.wizard.import'
-
- def _get_tools_name(self, cr, user, context):
- """
- @return the list of value of the selection field
- should be overwritten by subclasses
- """
- names = super(google_base_import, self)._get_tools_name(cr, user, context=context)
- names.append(('gmail','Gmail address book'))
- return names
-
-
- _columns = {
- 'tools': fields.selection(_get_tools_name, 'App to synchronize with'),
- }
-
-
- def _get_actions_dic(self, cr, uid, context=None):
- """
- this method should be overwritten in specialize module
- @return the dictonnaries of action
- """
- actions = super(google_base_import, self)._get_actions_dic(cr, uid, context=context)
-
- data_obj = self.pool.get('ir.model.data')
- data_id = data_obj._get_id(cr, uid, 'google_base_account', 'view_google_login_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': 'google.login.contact',
- 'view_id': False,
- 'context': context,
- 'views': [(view_id, 'form')],
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- }
- actions['gmail'] = value
- return actions
-
-google_base_import()
-
class google_contact_import(osv.osv_memory):
_inherit = 'google.login'
_name = 'google.login.contact'
@@ -120,12 +73,12 @@
return res
_columns = {
- 'create_partner': fields.boolean('Create Partner', help="It will create Partner for given gmail user otherwise only adds contacts in Partner Addresses.") ,
- 'group_name': fields.selection(_get_group, "Group Name", size=32,help="Choose which group to import, By defult it take all "),
+ 'create_partner': fields.selection([('create_all','Create partner for each contact'),('create_address','Import only address')],'Options'),
+ 'group_name': fields.selection(_get_group, "Group Name", size=32,help="Choose which group to import, By default it takes all."),
}
_defaults = {
- 'create_partner': True,
+ 'create_partner': 'create_all',
'group_name': 'all',
}
@@ -138,7 +91,7 @@
return partner_id, data
def import_contact(self, cr, uid, ids, context=None):
- obj=self.browse(cr, uid, ids, context=context)[0]
+ obj = self.browse(cr, uid, ids, context=context)[0]
if obj.group_name == 'none':
return { 'type': 'ir.actions.act_window_close' }
@@ -155,12 +108,12 @@
if obj.group_name not in ['all','none']:
query = gdata.contacts.service.ContactsQuery()
- query.group =obj.group_name
+ query.group = obj.group_name
contact = gd_client.GetContactsFeed(query.ToUri())
else:
contact = gd_client.GetContactsFeed()
- ids = self.create_contact( cr, uid, gd_client,contact, partner_id=obj.create_partner,context=context)
+ ids = self.create_contact(cr, uid, gd_client, contact, option=obj.create_partner,context=context)
if not ids:
return {'type': 'ir.actions.act_window_close'}
@@ -176,7 +129,7 @@
}
- def create_contact(self, cr, uid, gd_client,contact, partner_id=False,context=None):
+ def create_contact(self, cr, uid, gd_client, contact, option,context=None):
model_obj = self.pool.get('ir.model.data')
addresss_obj = self.pool.get('res.partner.address')
addresses = []
@@ -227,7 +180,7 @@
#create or link to an existing partner only if it's a new contact
res_id = addresss_obj.create(cr, uid, data, context=context)
data['address_id'] = res_id
- if partner_id:
+ if option == 'create_all':
partner_id, data = self.create_partner(cr, uid, data, context=context)
partner_ids.append(partner_id[0])
addresses.append(res_id)
@@ -237,15 +190,15 @@
next = contact.GetNextLink()
contact = next and gd_client.GetContactsFeed(next.href) or None
- if partner_id:
+ if option == 'create_all':
return partner_ids
else:
return addresses
- def update_contact(self, cr, uid, contact_ids, data,context=None):
+ def update_contact(self, cr, uid, contact_ids, data, context=None):
addresss_obj = self.pool.get('res.partner.address')
- if context==None:
- context={}
+ if context == None:
+ context = {}
res = {}
addr = addresss_obj.browse(cr,uid,contact_ids)[0]
name = str((addr.name or addr.partner_id and addr.partner_id.name or '').encode('utf-8'))
=== modified file 'sync_google_contact/wizard/google_contact_import_view.xml'
--- sync_google_contact/wizard/google_contact_import_view.xml 2011-02-25 09:37:17 +0000
+++ sync_google_contact/wizard/google_contact_import_view.xml 2011-02-28 12:46:20 +0000
@@ -9,8 +9,8 @@
<form string="Import Google Contacts">
<group colspan="4" col="4">
<field name="group_name" />
- <separator string="Do you want to create partner?" colspan="4"/>
- <field name="create_partner" colspan="4"/>
+ <separator string="Import Options" colspan="4"/>
+ <field name="create_partner"/>
</group>
<separator string="" colspan="4"/>
<group colspan="4" col="4">
@@ -23,5 +23,25 @@
</form>
</field>
</record>
+
+
+ <!--
+ Login Action
+ -->
+ <record model="ir.actions.act_window" id="act_google_login_form">
+ <field name="name">Import contacts from your google account</field>
+ <field name="type">ir.actions.act_window</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="google_base_account.view_google_login_form" />
+ </record>
+
+
+ <menuitem id="menu_sync_contact"
+ parent="base.menu_address_book"
+ action="act_google_login_form"
+ sequence="40" />
</data>
</openerp>
Follow ups