summaryrefslogtreecommitdiff
path: root/addons/import_google/wizard/import_google.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/import_google/wizard/import_google.py')
-rw-r--r--addons/import_google/wizard/import_google.py14
1 files changed, 8 insertions, 6 deletions
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',