summaryrefslogtreecommitdiff
path: root/addons/import_google/wizard
diff options
context:
space:
mode:
authorVijaykumar Baladaniya <vba@tinyerp.com>2012-07-09 18:31:13 +0530
committerVijaykumar Baladaniya <vba@tinyerp.com>2012-07-09 18:31:13 +0530
commitbe2e95656aaa113addea2b510fcdcf2f890eaaa4 (patch)
treeabcb3dd4ef350a1b8ad0eaffdd2b9a1cb91521af /addons/import_google/wizard
parentb982ea278b33132def3927417b7a854b98b5028a (diff)
parent3925f76ce85854e5d4834902a05f57bcfc5ace85 (diff)
[MERGE]merged with trunk-survey-layout-tta
bzr revid: vba@tinyerp.com-20120709130113-3lchipgil9oqpglg
Diffstat (limited to 'addons/import_google/wizard')
-rw-r--r--addons/import_google/wizard/google_import_message_view.xml3
-rw-r--r--addons/import_google/wizard/import_google.py14
-rw-r--r--addons/import_google/wizard/import_google_data.py9
-rw-r--r--addons/import_google/wizard/import_google_data_view.xml32
4 files changed, 23 insertions, 35 deletions
diff --git a/addons/import_google/wizard/google_import_message_view.xml b/addons/import_google/wizard/google_import_message_view.xml
index 215de9ba59c..250239ea10c 100644
--- a/addons/import_google/wizard/google_import_message_view.xml
+++ b/addons/import_google/wizard/google_import_message_view.xml
@@ -8,9 +8,6 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Import Google Data" version="7.0">
- <header>
- <button icon="gtk-ok" special="cancel" string="_Ok"/>
- </header>
<group>
<field name='name'/>
</group>
diff --git a/addons/import_google/wizard/import_google.py b/addons/import_google/wizard/import_google.py
index f241fabf412..9a9b2802826 100644
--- a/addons/import_google/wizard/import_google.py
+++ b/addons/import_google/wizard/import_google.py
@@ -28,6 +28,8 @@ from pytz import timezone
from datetime import datetime
import time
from osv import *
+from tools.translate import _
+
try:
import gdata
import gdata.contacts.service
@@ -284,8 +286,8 @@ class google_import(import_framework):
data['id'] = entry.id.text
name = tools.ustr(entry.title.text)
if name == "None":
- name = entry.email[0].address
- data['name'] = name
+ name = entry.email and entry.email[0].address or ''
+ data['name'] = name or _('Unknown')
emails = ','.join(email.address for email in entry.email)
data['email'] = emails
if table == 'Contact':
@@ -314,13 +316,13 @@ class google_import(import_framework):
def get_contact_mapping(self):
return {
'model': 'res.partner',
- 'dependencies': [self.TABLE_ADDRESS],
+ #'dependencies': [self.TABLE_ADDRESS],
'map': {
'id':'id',
'name': value('company', fallback='name'),
'customer': 'customer',
'supplier': 'supplier',
- 'address/id': ref(self.TABLE_ADDRESS, 'id'),
+ 'child_ids/id': ref(self.TABLE_ADDRESS, 'id'),
}
}
@@ -337,11 +339,11 @@ class google_import(import_framework):
def get_address_mapping(self):
return {
- 'model': 'res.partner.address',
+ 'model': 'res.partner',
'dependencies': [],
'map': {
'id':'id',
- 'partner_id/.id': self.get_partner_id,
+ 'parent_id/.id': self.get_partner_id,
'name': 'name',
'city': 'city',
'phone': 'phone',
diff --git a/addons/import_google/wizard/import_google_data.py b/addons/import_google/wizard/import_google_data.py
index 9affc13899e..49127b85db8 100644
--- a/addons/import_google/wizard/import_google_data.py
+++ b/addons/import_google/wizard/import_google_data.py
@@ -102,7 +102,6 @@ class synchronize_google(osv.osv_memory):
return res
_columns = {
- 'create_partner': fields.selection([('create_all','Create partner for each contact'),('create_address','Import only address')],'Options'),
'customer': fields.boolean('Customer', help="Check this box to set newly created partner as Customer."),
'supplier': fields.boolean('Supplier', help="Check this box to set newly created partner as Supplier."),
'group_name': fields.selection(_get_group, "Group Name",help="Choose which group to import, By default it takes all."),
@@ -110,7 +109,6 @@ class synchronize_google(osv.osv_memory):
}
_defaults = {
- 'create_partner': 'create_all',
'group_name': 'all',
}
@@ -132,16 +130,13 @@ class synchronize_google(osv.osv_memory):
raise osv.except_osv(_('Error'), _("Invalid login detail !\n Specify Username/Password."))
if context.get('contact'):
- msg = " You're Contact are import in background, a email will be send when the process is finished to %s"%(user_obj.gmail_user)
+ msg = " Your contacts are being imported in background, an email to %s will be sent when the process is over" % (user_obj.gmail_user)
gd_client = google.google_login(gmail_user, gmail_pwd, type='contact')
if not gd_client:
raise osv.except_osv(_('Error'), _("Please specify correct user and password !"))
if obj.group_name not in ['all']:
context.update({ 'group_name': obj.group_name})
- if obj.create_partner=='create_all':
- tables.append('Contact')
- else:
- tables.append('Address')
+ tables.append('Contact')
context.update({'user': gmail_user,
'password': gmail_pwd,
'instance': 'contact',
diff --git a/addons/import_google/wizard/import_google_data_view.xml b/addons/import_google/wizard/import_google_data_view.xml
index 7df067a643b..2968b009a51 100644
--- a/addons/import_google/wizard/import_google_data_view.xml
+++ b/addons/import_google/wizard/import_google_data_view.xml
@@ -6,25 +6,21 @@
<field name="model">synchronize.google.import</field>
<field name="type">form</field>
<field name="arch" type="xml">
- <form string="Import contacts from a google account">
+ <form string="Import contacts from a google account" version="7.0">
+ <header>
+ <button name="import_google" string="_Import Contacts" type="object" class="oe_highlight" />
+ or
+ <button string="Cancel" class="oe_link" special="cancel" />
+ </header>
<group colspan="4" col="4" width="430">
<field name="group_name" colspan="4"/>
- <separator string="Import Options" colspan="4"/>
- <field name="create_partner" colspan="4"/>
<newline/>
- <group attrs="{'invisible': [('create_partner','!=','create_all')]}" colspan="4" col="4">
+ <group colspan="4" col="4">
<separator string="Partner Status for this Group:" colspan="4"/>
<field name="customer" colspan="4"/>
<field name="supplier" colspan="4"/>
</group>
</group>
- <separator string="" colspan="4"/>
- <group colspan="4" col="4">
- <group colspan="2" col="2">
- <button special="cancel" string="_Cancel" icon="gtk-cancel"/>
- <button name="import_google" string="_Import Contacts" type="object" icon="terp-personal+"/>
- </group>
- </group>
</form>
</field>
</record>
@@ -36,17 +32,15 @@
<field name="model">synchronize.google.import</field>
<field name="type">form</field>
<field name="arch" type="xml">
- <form string="Import Google Calendar Events">
+ <form string="Import Google Calendar Events" version="7.0">
+ <header>
+ <button name="import_google" string="_Import Events" type="object" class="oe_highlight" />
+ or
+ <button string="Cancel" class="oe_link" special="cancel" />
+ </header>
<group colspan="4" col="4" width="320">
<field name="calendar_name" />
</group>
- <separator string="" colspan="4"/>
- <group colspan="4" col="4">
- <group colspan="2" col="2">
- <button special="cancel" string="_Cancel" icon="gtk-cancel"/>
- <button name="import_google" string="_Import Events" type="object" icon="terp-calendar"/>
- </group>
- </group>
</form>
</field>
</record>