[IMP] sync_google_contact: improve contact wizard

bzr revid: sbh@tinyerp.com-20110214073346-wbenzus1eqdqomrw
This commit is contained in:
Sbh (OpenERP) 2011-02-14 13:03:46 +05:30
parent b99cb58c90
commit 8692fbcc10
5 changed files with 14 additions and 10 deletions

View File

@ -19,6 +19,7 @@
#
##############################################################################
import sync_base
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -31,7 +31,7 @@
'init_xml': [],
'update_xml': [
#'google_contact_view.xml',
#'wizard/google_contact_import_view.xml'
'wizard/google_contact_import_view.xml'
],
'demo_xml': [],
'installable': True,

View File

@ -19,6 +19,6 @@
#
##############################################################################
#import google_contact_import
import google_contact_import
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -28,16 +28,19 @@ class google_contact_import(osv.osv_memory):
_name = "synchronize.base"
_inherit = 'synchronize.base'
_columns = {
'tools': fields.selection([('gmail','Gmail')], 'App to synchronize with'),
'create_partner':fields.selection([('group','Group'),('email_address','Email address'),('gmail_user','Gmail user')], ''),
'tools': fields.selection([('gmail','Gmail')],'Tools'),
'create_partner':fields.selection([('group','Group'),('email_address','Email address'),('gmail_user','Gmail user')], 'Create Partner'),
}
def import_contact(self, cr, uid, ids, context=None):
# Only see the result, we will change the code
addresss_obj = self.pool.get('res.partner.address')
user_obj=self.pool.get('res.users').browse(cr, uid, uid)
gmail_user=user_obj.gmail_user
gamil_pwd=user_obj.gmail_password
for obj in self.browse(cr, uid, ids, context=context):
google_obj = sync_google_contact.google_lib(obj.user, obj.password)
google_obj = sync_google_contact.google_lib(gmail_user, gamil_pwd)
contact = google_obj._get_contact()
addresses = []
while contact:

View File

@ -3,12 +3,12 @@
<data>
<record model="ir.ui.view" id="view_google_contact_import_form">
<field name="name">google.contact.import.form</field>
<field name="model">google.contact.import</field>
<field name="name">synchronize.base.import.form</field>
<field name="model">synchronize.base</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Import Google Contacts">
<group colspan="4" col="4">
<group colspan="2" col="2">
<field name="tools"/>
<field name="create_partner" />
</group>
@ -24,7 +24,7 @@
<record model="ir.actions.act_window" id="act_google_contact_import_form">
<field name="name">Import Google Contacts</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">google.contact.import</field>
<field name="res_model">synchronize.base</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>