From b999a061d835a5e1695fa1b3883346a76e64a49b Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Thu, 28 Jun 2012 12:07:29 +0530 Subject: [IMP]improve code where needed and replace res.partner instead of res.partner.address bzr revid: sgo@tinyerp.com-20120628063729-1ccb8c45pxa31025 --- addons/import_google/wizard/import_google.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'addons/import_google/wizard/import_google.py') diff --git a/addons/import_google/wizard/import_google.py b/addons/import_google/wizard/import_google.py index f241fabf412..6d53fd55c33 100644 --- a/addons/import_google/wizard/import_google.py +++ b/addons/import_google/wizard/import_google.py @@ -284,8 +284,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 +314,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 +337,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', -- cgit v1.2.3 From 46f2c2c9ca8662de3c1c8fc79fbdb1355367bc49 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 28 Jun 2012 14:18:20 +0200 Subject: [IMP] improvements during code review bzr revid: qdp-launchpad@openerp.com-20120628121820-r8bxfzq38fy8pcgt --- addons/import_google/wizard/import_google.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/import_google/wizard/import_google.py') diff --git a/addons/import_google/wizard/import_google.py b/addons/import_google/wizard/import_google.py index 6d53fd55c33..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 @@ -285,7 +287,7 @@ class google_import(import_framework): name = tools.ustr(entry.title.text) if name == "None": name = entry.email and entry.email[0].address or '' - data['name'] = name or 'Unknown' + data['name'] = name or _('Unknown') emails = ','.join(email.address for email in entry.email) data['email'] = emails if table == 'Contact': -- cgit v1.2.3