diff options
Diffstat (limited to 'addons/import_google')
9 files changed, 265 insertions, 94 deletions
diff --git a/addons/import_google/__openerp__.py b/addons/import_google/__openerp__.py index dee0e608d45..5c538e5912f 100644 --- a/addons/import_google/__openerp__.py +++ b/addons/import_google/__openerp__.py @@ -37,7 +37,6 @@ 'demo_xml': [], 'test': [ #'test/test_sync_google_contact_import_partner.yml', - # 'test/test_sync_google_contact_import_address.yml', #'test/test_sync_google_calendar.yml', ], 'installable': True, diff --git a/addons/import_google/i18n/sv.po b/addons/import_google/i18n/sv.po new file mode 100644 index 00000000000..73506190503 --- /dev/null +++ b/addons/import_google/i18n/sv.po @@ -0,0 +1,219 @@ +# Swedish translation for openobject-addons +# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2012. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" +"POT-Creation-Date: 2012-02-08 00:36+0000\n" +"PO-Revision-Date: 2012-06-27 11:40+0000\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: Swedish <sv@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2012-06-28 04:41+0000\n" +"X-Generator: Launchpad (build 15505)\n" + +#. module: import_google +#: help:synchronize.google.import,group_name:0 +msgid "Choose which group to import, By default it takes all." +msgstr "" + +#. module: import_google +#: view:synchronize.google.import:0 +msgid "Import Google Calendar Events" +msgstr "" + +#. module: import_google +#: view:synchronize.google.import:0 +msgid "_Import Events" +msgstr "" + +#. module: import_google +#: code:addons/import_google/wizard/import_google_data.py:71 +#, python-format +msgid "" +"No Google Username or password Defined for user.\n" +"Please define in user view" +msgstr "" + +#. module: import_google +#: code:addons/import_google/wizard/import_google_data.py:127 +#, python-format +msgid "" +"Invalid login detail !\n" +" Specify Username/Password." +msgstr "" + +#. module: import_google +#: field:synchronize.google.import,supplier:0 +msgid "Supplier" +msgstr "Leverantör" + +#. module: import_google +#: view:synchronize.google.import:0 +msgid "Import Options" +msgstr "Importalternativ" + +#. module: import_google +#: field:synchronize.google.import,group_name:0 +msgid "Group Name" +msgstr "Gruppnamn" + +#. module: import_google +#: model:ir.model,name:import_google.model_crm_case_categ +msgid "Category of Case" +msgstr "Ärendekategori" + +#. module: import_google +#: model:ir.actions.act_window,name:import_google.act_google_login_contact_form +#: model:ir.ui.menu,name:import_google.menu_sync_contact +msgid "Import Google Contacts" +msgstr "Importera Googlekontakter" + +#. module: import_google +#: view:google.import.message:0 +msgid "Import Google Data" +msgstr "Importera Google-data" + +#. module: import_google +#: view:crm.meeting:0 +msgid "Meeting Type" +msgstr "Mötestyp" + +#. module: import_google +#: code:addons/import_google/wizard/import_google.py:38 +#: code:addons/import_google/wizard/import_google_data.py:28 +#, python-format +msgid "" +"Please install gdata-python-client from http://code.google.com/p/gdata-" +"python-client/downloads/list" +msgstr "" +"Vänligen installera gdata-python-client från http://code.google.com/p/gdata-" +"python-client/downloads/list" + +#. module: import_google +#: model:ir.model,name:import_google.model_google_login +msgid "Google Contact" +msgstr "Google-kontakt" + +#. module: import_google +#: view:synchronize.google.import:0 +msgid "Import contacts from a google account" +msgstr "" + +#. module: import_google +#: code:addons/import_google/wizard/import_google_data.py:133 +#, python-format +msgid "Please specify correct user and password !" +msgstr "" + +#. module: import_google +#: field:synchronize.google.import,customer:0 +msgid "Customer" +msgstr "Kund" + +#. module: import_google +#: view:synchronize.google.import:0 +msgid "_Cancel" +msgstr "_Avbryt" + +#. module: import_google +#: model:ir.model,name:import_google.model_synchronize_google_import +msgid "synchronize.google.import" +msgstr "synchronize.google.import" + +#. module: import_google +#: view:synchronize.google.import:0 +msgid "_Import Contacts" +msgstr "" + +#. module: import_google +#: model:ir.actions.act_window,name:import_google.act_google_login_form +#: model:ir.ui.menu,name:import_google.menu_sync_calendar +msgid "Import Google Calendar" +msgstr "" + +#. module: import_google +#: code:addons/import_google/wizard/import_google_data.py:50 +#, python-format +msgid "Import google" +msgstr "" + +#. module: import_google +#: code:addons/import_google/wizard/import_google_data.py:127 +#: code:addons/import_google/wizard/import_google_data.py:133 +#, python-format +msgid "Error" +msgstr "Fel" + +#. module: import_google +#: code:addons/import_google/wizard/import_google_data.py:71 +#, python-format +msgid "Warning !" +msgstr "Varning !" + +#. module: import_google +#: field:synchronize.google.import,create_partner:0 +msgid "Options" +msgstr "Alternativ" + +#. module: import_google +#: view:google.import.message:0 +msgid "_Ok" +msgstr "_Ok" + +#. module: import_google +#: code:addons/import_google/wizard/import_google.py:38 +#: code:addons/import_google/wizard/import_google_data.py:28 +#, python-format +msgid "Google Contacts Import Error!" +msgstr "Google kontaktimportfel!" + +#. module: import_google +#: model:ir.model,name:import_google.model_google_import_message +msgid "Import Message" +msgstr "" + +#. module: import_google +#: field:synchronize.google.import,calendar_name:0 +msgid "Calendar Name" +msgstr "Kalendernamn" + +#. module: import_google +#: help:synchronize.google.import,supplier:0 +msgid "Check this box to set newly created partner as Supplier." +msgstr "" + +#. module: import_google +#: selection:synchronize.google.import,create_partner:0 +msgid "Import only address" +msgstr "" + +#. module: import_google +#: field:crm.case.categ,user_id:0 +msgid "User" +msgstr "" + +#. module: import_google +#: view:synchronize.google.import:0 +msgid "Partner Status for this Group:" +msgstr "" + +#. module: import_google +#: field:google.import.message,name:0 +msgid "Message" +msgstr "" + +#. module: import_google +#: selection:synchronize.google.import,create_partner:0 +msgid "Create partner for each contact" +msgstr "" + +#. module: import_google +#: help:synchronize.google.import,customer:0 +msgid "Check this box to set newly created partner as Customer." +msgstr "" diff --git a/addons/import_google/sync_google_calendar_view.xml b/addons/import_google/sync_google_calendar_view.xml index 8b51576edac..84f0176c5ec 100644 --- a/addons/import_google/sync_google_calendar_view.xml +++ b/addons/import_google/sync_google_calendar_view.xml @@ -2,31 +2,31 @@ <openerp> <data> <record model="ir.ui.view" id="crm_case_form_view_meet_inherit"> - <field name="name">CRM - Meetings Form (Inherited)</field> - <field name="model">crm.meeting</field> - <field name="type">form</field> - <field name="inherit_id" ref="crm.crm_case_form_view_meet"/> - <field name="arch" type="xml"> - <field name="categ_id" position="replace"> - <field name="categ_id" widget="selection" - string="Meeting Type" - domain="[('object_id.model', '=', 'crm.meeting'),('user_id','in',[uid, False])]" /> - </field> - </field> + <field name="name">CRM - Meetings Form (Inherited)</field> + <field name="model">crm.meeting</field> + <field name="type">form</field> + <field name="inherit_id" ref="crm.crm_case_form_view_meet"/> + <field name="arch" type="xml"> + <field name="categ_id" position="replace"> + <field name="categ_id" widget="selection" + string="Meeting Type" + domain="[('object_id.model', '=', 'crm.meeting'),('user_id','in',[uid, False])]" /> + </field> + </field> </record> <record model="ir.ui.view" id="crm_case_tree_view_meet_inherit"> - <field name="name">CRM - Meetings Tree (Inherited)</field> - <field name="model">crm.meeting</field> - <field name="type">tree</field> - <field name="inherit_id" ref="crm.crm_case_tree_view_meet"/> - <field name="arch" type="xml"> - <field name="categ_id" position="replace"> + <field name="name">CRM - Meetings Tree (Inherited)</field> + <field name="model">crm.meeting</field> + <field name="type">tree</field> + <field name="inherit_id" ref="crm.crm_case_tree_view_meet"/> + <field name="arch" type="xml"> + <field name="categ_id" position="replace"> <field name="categ_id" widget="selection" string="Meeting Type" domain="[('object_id.model', '=', 'crm.meeting'),('user_id','in',[uid, False])]" /> </field> - </field> - </record> + </field> + </record> </data> </openerp> diff --git a/addons/import_google/test/test_sync_google_contact_import_address.yml b/addons/import_google/test/test_sync_google_contact_import_address.yml deleted file mode 100644 index b1a8f9a2e09..00000000000 --- a/addons/import_google/test/test_sync_google_contact_import_address.yml +++ /dev/null @@ -1,34 +0,0 @@ -- - In order to test Importing contacts from any google account into OpenERP, - I use a gmail account and import the contact details and store them as Partner addresses. -- | - I create a record for the gmail account for which I want to import the contacts. -- - !record {model: google.login, id: google_login_id0}: - user: testmail.openerp@gmail.com - password: openerptiny -- | - I login into that account. -- - !python {model: google.login}: | - self.login(cr, uid, [ref('google_login_id0')], context) -- | - Now I select from which group I want to get the contact details. -- - !record {model: synchronize.google.import, id: synchronize_google_import_id0}: - create_partner: create_address - group_name: all - calendar_name: all -- | - I import the contacts and I also check if the contact already exists in db and updates the address. -- - !python {model: synchronize.google.import}: | - self.import_google(cr, uid, [ref('synchronize_google_import_id0')], context={'contact':True}) -- | - I check whether the Contacts are created in Partner address or not. -- - !python {model: res.partner.address}: | - addr_obj = self.pool.get('ir.model.data') - data_ids = addr_obj.search(cr, uid, [('model','=','res.partner.address'),('module','=','synchronize_google')]) - assert data_ids, 'Addresses not created !' -
\ No newline at end of file diff --git a/addons/import_google/test/test_sync_google_contact_import_partner.yml b/addons/import_google/test/test_sync_google_contact_import_partner.yml index 4eadbf0f100..08aa0f30718 100644 --- a/addons/import_google/test/test_sync_google_contact_import_partner.yml +++ b/addons/import_google/test/test_sync_google_contact_import_partner.yml @@ -16,7 +16,6 @@ Now I select from which group I want to get the contact details and I want to create partner for all contacts. - !record {model: synchronize.google.import, id: synchronize_google_import_id1}: - create_partner: create_all group_name: all - | I import the contacts. @@ -26,11 +25,11 @@ - | I check whether the Partners are created or not. - - !python {model: res.partner.address }: | + !python {model: res.partner }: | addr_obj = self.pool.get('ir.model.data') addr_ids = addr_obj.search(cr, uid, []) - data_ids = addr_obj.search(cr, uid, [('model','=','res.partner.address'),('module','=','synchronize_google')]) + data_ids = addr_obj.search(cr, uid, [('model','=','res.partner'),('module','=','synchronize_google')]) address_ids = map(lambda x: x.res_id, [child for child in addr_obj.browse(cr, uid, data_ids) if child.res_id]) - partner_ids = map(lambda x: x.partner_id.id, [addr for addr in self.browse(cr, uid, address_ids) if addr.partner_id]) + partner_ids = map(lambda x: x.parent_id.id, [addr for addr in self.browse(cr, uid, address_ids) if addr.parent_id]) assert partner_ids, 'Partners not created !' -
\ No newline at end of file + 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> |
