From ec017acc0787793610e419472fefbc93c05cd46e Mon Sep 17 00:00:00 2001 From: Vijaykumar Baladaniya Date: Mon, 15 Oct 2012 12:44:27 +0530 Subject: [PATCH] [IMP]Improve code. bzr revid: vba@tinyerp.com-20121015071427-kgi4rlcqy6pwx8u9 --- addons/google_docs/google_docs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 47029e78210..cdae5ab0399 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -125,7 +125,10 @@ class google_docs_ir_attachment(osv.osv): google_docs_config = pool_gdoc_config.search(cr, uid, [('model_id', '=', res_model)], context=context) if google_docs_config: name_gdocs = pool_gdoc_config.browse(cr, uid, google_docs_config, context=context)[0].name_template + try: name_gdocs = name_gdocs % model_fields_dic + except: + raise osv.except_osv(_('Key Error!'), _("Your Google Doc Name Pattern is not correct.")) google_template_id = pool_gdoc_config.browse(cr, uid, google_docs_config[0], context=context).gdocs_resource_id google_document = pool_ir_attachment.copy_gdoc(cr, uid, res_model, res_id, name_gdocs, google_template_id, context=context) else: @@ -138,7 +141,7 @@ class config(osv.osv): _columns = { 'model_id': fields.many2one('ir.model', 'Model', required=True), - 'gdocs_resource_id': fields.char('Google Resource ID to Use as Template', size=256, help=''' + 'gdocs_resource_id': fields.char('Google Resource ID to Use as Template', size=64, help=''' This is the id of the template document, on google side. You can find it thanks to its URL: *for a text document with url like `https://docs.google.com/a/openerp.com/document/d/123456789/edit`, the ID is `document:123456789` *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`