summaryrefslogtreecommitdiff
path: root/addons/google_docs
diff options
context:
space:
mode:
authorRaphael Collet <rco@openerp.com>2013-02-13 09:35:19 +0100
committerRaphael Collet <rco@openerp.com>2013-02-13 09:35:19 +0100
commit5f855a1ddba79697a0337a3d2af5f97bc1730d22 (patch)
tree204bf61d60e161e209268f5c1b9765450c80d4b6 /addons/google_docs
parent9b8d7de0ac0a0325ffd4052ffd7bd2b5e11f6b63 (diff)
parent4f8081e1fd0f62d32a1bb8d217230c043aa54a2e (diff)
[MERGE] from trunk
bzr revid: rco@openerp.com-20130213083519-3nbg40h5em0gfeu3
Diffstat (limited to 'addons/google_docs')
-rw-r--r--addons/google_docs/google_docs.py46
-rw-r--r--addons/google_docs/i18n/tr.po188
2 files changed, 225 insertions, 9 deletions
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 4b98798c832..cdb14de1de3 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -29,13 +29,40 @@ _logger = logging.getLogger(__name__)
try:
import gdata.docs.data
import gdata.docs.client
- from gdata.client import RequestError
- from gdata.docs.service import DOCUMENT_LABEL
- import gdata.auth
- from gdata.docs.data import Resource
+
+ # API breakage madness in the gdata API - those guys are insane.
+ try:
+ # gdata 2.0.15+
+ gdata.docs.client.DocsClient.copy_resource
+ except AttributeError:
+ # gdata 2.0.14- : copy_resource() was copy()
+ gdata.docs.client.DocsClient.copy_resource = gdata.docs.client.DocsClient.copy
+
+ try:
+ # gdata 2.0.16+
+ gdata.docs.client.DocsClient.get_resource_by_id
+ except AttributeError:
+ try:
+ # gdata 2.0.15+
+ gdata.docs.client.DocsClient.get_resource_by_self_link
+ def get_resource_by_id_2_0_16(self, resource_id, **kwargs):
+ return self.GetResourceBySelfLink(
+ gdata.docs.client.RESOURCE_FEED_URI + ('/%s' % resource_id), **kwargs)
+ gdata.docs.client.DocsClient.get_resource_by_id = get_resource_by_id_2_0_16
+ except AttributeError:
+ # gdata 2.0.14- : alias get_resource_by_id()
+ gdata.docs.client.DocsClient.get_resource_by_id = gdata.docs.client.DocsClient.get_doc
+
+ try:
+ import atom.http_interface
+ _logger.info('GData lib version `%s` detected' % atom.http_interface.USER_AGENT)
+ except (ImportError, AttributeError):
+ _logger.debug('GData lib version could not be detected', exc_info=True)
+
except ImportError:
_logger.warning("Please install latest gdata-python-client from http://code.google.com/p/gdata-python-client/downloads/list")
+
class google_docs_ir_attachment(osv.osv):
_inherit = 'ir.attachment'
@@ -49,11 +76,12 @@ class google_docs_ir_attachment(osv.osv):
#get gmail password and login. We use default_get() instead of a create() followed by a read() on the
# google.login object, because it is easier. The keys 'user' and 'password' ahve to be passed in the dict
# but the values will be replaced by the user gmail password and login.
- user_config = google_pool.default_get( cr, uid, {'user' : '' , 'password' : ''}, context=context)
+ user_config = google_pool.default_get(cr, uid, {'user' : '' , 'password' : ''}, context=context)
#login gmail account
- client = google_pool.google_login( user_config['user'], user_config['password'], type='docs_client', context=context)
+ client = google_pool.google_login(user_config['user'], user_config['password'], type='docs_client', context=context)
if not client:
- raise osv.except_osv( _('Google Docs Error!'), _("Check your google configuration in Users/Users/Synchronization tab."))
+ raise osv.except_osv(_('Google Docs Error!'), _("Check your google configuration in Users/Users/Synchronization tab."))
+ _logger.info('Logged into google docs as %s', user_config['user'])
return client
def create_empty_google_doc(self, cr, uid, res_model, res_id, context=None):
@@ -94,9 +122,9 @@ class google_docs_ir_attachment(osv.osv):
client = self._auth(cr, uid)
# fetch and copy the original document
try:
- doc = client.GetDoc(gdoc_template_id)
+ doc = client.get_resource_by_id(gdoc_template_id)
#copy the document you choose in the configuration
- copy_resource = client.copy(doc, name_gdocs)
+ copy_resource = client.copy_resource(doc, name_gdocs)
except:
raise osv.except_osv(_('Google Docs Error!'), _("Your resource id is not correct. You can find the id in the google docs URL."))
# create an ir.attachment
diff --git a/addons/google_docs/i18n/tr.po b/addons/google_docs/i18n/tr.po
new file mode 100644
index 00000000000..2225db3c2ee
--- /dev/null
+++ b/addons/google_docs/i18n/tr.po
@@ -0,0 +1,188 @@
+# Turkish translation for openobject-addons
+# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013
+# This file is distributed under the same license as the openobject-addons package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2013.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: openobject-addons\n"
+"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
+"POT-Creation-Date: 2012-12-21 17:05+0000\n"
+"PO-Revision-Date: 2013-02-04 14:07+0000\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: Turkish <tr@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: 2013-02-05 04:44+0000\n"
+"X-Generator: Launchpad (build 16468)\n"
+
+#. module: google_docs
+#: code:addons/google_docs/google_docs.py:139
+#, python-format
+msgid "Key Error!"
+msgstr ""
+
+#. module: google_docs
+#: view:google.docs.config:0
+msgid ""
+"for a presentation (slide show) document with url like "
+"`https://docs.google.com/a/openerp.com/presentation/d/123456789/edit#slide=id"
+".p`, the ID is `presentation:123456789`"
+msgstr ""
+
+#. module: google_docs
+#: view:google.docs.config:0
+msgid ""
+"for a text document with url like "
+"`https://docs.google.com/a/openerp.com/document/d/123456789/edit`, the ID is "
+"`document:123456789`"
+msgstr ""
+
+#. module: google_docs
+#: field:google.docs.config,gdocs_resource_id:0
+msgid "Google Resource ID to Use as Template"
+msgstr ""
+
+#. module: google_docs
+#: view:google.docs.config:0
+msgid ""
+"for a drawing document with url like "
+"`https://docs.google.com/a/openerp.com/drawings/d/123456789/edit`, the ID is "
+"`drawings:123456789`"
+msgstr ""
+
+#. module: google_docs
+#. openerp-web
+#: code:addons/google_docs/static/src/xml/gdocs.xml:6
+#, python-format
+msgid "Add Google Doc..."
+msgstr ""
+
+#. module: google_docs
+#: view:google.docs.config:0
+msgid ""
+"This is the id of the template document, on google side. You can find it "
+"thanks to its URL:"
+msgstr ""
+
+#. module: google_docs
+#: model:ir.model,name:google_docs.model_google_docs_config
+msgid "Google Docs templates config"
+msgstr ""
+
+#. module: google_docs
+#. openerp-web
+#: code:addons/google_docs/static/src/js/gdocs.js:25
+#, python-format
+msgid ""
+"The user google credentials are not set yet. Contact your administrator for "
+"help."
+msgstr ""
+
+#. module: google_docs
+#: view:google.docs.config:0
+msgid ""
+"for a spreadsheet document with url like "
+"`https://docs.google.com/a/openerp.com/spreadsheet/ccc?key=123456789#gid=0`, "
+"the ID is `spreadsheet:123456789`"
+msgstr ""
+
+#. module: google_docs
+#: code:addons/google_docs/google_docs.py:101
+#, python-format
+msgid ""
+"Your resource id is not correct. You can find the id in the google docs URL."
+msgstr ""
+
+#. module: google_docs
+#: code:addons/google_docs/google_docs.py:125
+#, python-format
+msgid "Creating google docs may only be done by one at a time."
+msgstr ""
+
+#. module: google_docs
+#: code:addons/google_docs/google_docs.py:56
+#: code:addons/google_docs/google_docs.py:101
+#: code:addons/google_docs/google_docs.py:125
+#, python-format
+msgid "Google Docs Error!"
+msgstr ""
+
+#. module: google_docs
+#: code:addons/google_docs/google_docs.py:56
+#, python-format
+msgid "Check your google configuration in Users/Users/Synchronization tab."
+msgstr ""
+
+#. module: google_docs
+#: model:ir.ui.menu,name:google_docs.menu_gdocs_config
+msgid "Google Docs configuration"
+msgstr ""
+
+#. module: google_docs
+#: model:ir.actions.act_window,name:google_docs.action_google_docs_users_config
+#: model:ir.ui.menu,name:google_docs.menu_gdocs_model_config
+msgid "Models configuration"
+msgstr ""
+
+#. module: google_docs
+#: field:google.docs.config,model_id:0
+msgid "Model"
+msgstr ""
+
+#. module: google_docs
+#. openerp-web
+#: code:addons/google_docs/static/src/js/gdocs.js:28
+#, python-format
+msgid "User Google credentials are not yet set."
+msgstr ""
+
+#. module: google_docs
+#: code:addons/google_docs/google_docs.py:139
+#, python-format
+msgid "Your Google Doc Name Pattern's key does not found in object."
+msgstr ""
+
+#. module: google_docs
+#: help:google.docs.config,name_template:0
+msgid ""
+"Choose how the new google docs will be named, on google side. Eg. "
+"gdoc_%(field_name)s"
+msgstr ""
+
+#. module: google_docs
+#: view:google.docs.config:0
+msgid "Google Docs Configuration"
+msgstr ""
+
+#. module: google_docs
+#: help:google.docs.config,gdocs_resource_id:0
+msgid ""
+"\n"
+"This is the id of the template document, on google side. You can find it "
+"thanks to its URL: \n"
+"*for a text document with url like "
+"`https://docs.google.com/a/openerp.com/document/d/123456789/edit`, the ID is "
+"`document:123456789`\n"
+"*for a spreadsheet document with url like "
+"`https://docs.google.com/a/openerp.com/spreadsheet/ccc?key=123456789#gid=0`, "
+"the ID is `spreadsheet:123456789`\n"
+"*for a presentation (slide show) document with url like "
+"`https://docs.google.com/a/openerp.com/presentation/d/123456789/edit#slide=id"
+".p`, the ID is `presentation:123456789`\n"
+"*for a drawing document with url like "
+"`https://docs.google.com/a/openerp.com/drawings/d/123456789/edit`, the ID is "
+"`drawings:123456789`\n"
+"...\n"
+msgstr ""
+
+#. module: google_docs
+#: model:ir.model,name:google_docs.model_ir_attachment
+msgid "ir.attachment"
+msgstr ""
+
+#. module: google_docs
+#: field:google.docs.config,name_template:0
+msgid "Google Doc Name Pattern"
+msgstr ""