From 2c6281b4fb1c1512c4bdeb5e70c7e17fd73c5a67 Mon Sep 17 00:00:00 2001 From: Vijaykumar Baladaniya Date: Mon, 15 Oct 2012 11:41:28 +0530 Subject: Improve field size and make required field. bzr revid: vba@tinyerp.com-20121015061128-in7l3ncrld2yc7kf --- addons/google_docs/google_docs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/google_docs/google_docs.py') diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index f1477f9c7f2..76530c1290c 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -135,7 +135,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=64,help=''' + 'gdocs_resource_id': fields.char('Google Resource ID to Use as Template', size=256, 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` @@ -143,7 +143,7 @@ This is the id of the template document, on google side. You can find it thanks *for a drawing document with url like `https://docs.google.com/a/openerp.com/drawings/d/123456789/edit`, the ID is `drawings:123456789` ... '''), - 'name_template': fields.char('Google Doc Name Pattern', size=64, help='Choose how the new google docs will be named, on google side'), + 'name_template': fields.char('Google Doc Name Pattern', size=64, help='Choose how the new google docs will be named, on google side', required=True), } _defaults = { -- cgit v1.2.3 From ec017acc0787793610e419472fefbc93c05cd46e Mon Sep 17 00:00:00 2001 From: Vijaykumar Baladaniya Date: Mon, 15 Oct 2012 12:44:27 +0530 Subject: [IMP]Improve code. bzr revid: vba@tinyerp.com-20121015071427-kgi4rlcqy6pwx8u9 --- addons/google_docs/google_docs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'addons/google_docs/google_docs.py') 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` -- cgit v1.2.3 From 66f00492b140566fa136c5ef55cd95dbb362d1ec Mon Sep 17 00:00:00 2001 From: Vijaykumar Baladaniya Date: Mon, 15 Oct 2012 13:08:03 +0530 Subject: [IMP]Improve message. bzr revid: vba@tinyerp.com-20121015073803-vr85y6d1n03al7u2 --- addons/google_docs/google_docs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/google_docs/google_docs.py') diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index cdae5ab0399..7be713f4bbb 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -128,7 +128,7 @@ class google_docs_ir_attachment(osv.osv): try: name_gdocs = name_gdocs % model_fields_dic except: - raise osv.except_osv(_('Key Error!'), _("Your Google Doc Name Pattern is not correct.")) + raise osv.except_osv(_('Key Error!'), _("Your Google Doc Name Pattern's key does not found in object.")) 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: -- cgit v1.2.3 From 067fa7fe7cd631a4cb50d494c7d99c050dd7fd28 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 17 Oct 2012 12:16:15 +0530 Subject: [FIX] bzr revid: hmo@tinyerp.com-20121017064615-gaodqeqwx25rgt34 --- addons/google_docs/google_docs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'addons/google_docs/google_docs.py') diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 7be713f4bbb..6e839969998 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -125,10 +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's key does not found in object.")) + try: + name_gdocs = name_gdocs % model_fields_dic + except: + raise osv.except_osv(_('Key Error!'), _("Your Google Doc Name Pattern's key does not found in object.")) 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: -- cgit v1.2.3 From 3da067914a9f2e3574213f2aba492c45bfb55d8d Mon Sep 17 00:00:00 2001 From: TTA <> Date: Fri, 19 Oct 2012 16:10:20 +0530 Subject: Fixed list view issue. bzr revid: vba@tinyerp.com-20121019104020-9tz7t6h7xwa4dali --- addons/google_docs/google_docs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/google_docs/google_docs.py') diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 6e839969998..f0f6f22a7c5 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -114,7 +114,8 @@ class google_docs_ir_attachment(osv.osv): a length of 1 element only (batch processing is not supported in the code, though nothing really prevent it) :return: the google document object created ''' - assert len(ids) == 1, 'Creating google docs may only be done by one at a time' + if len(ids) != 1: + raise osv.except_osv(_('Google Docs Error!'), _("Creating google docs may only be done by one at a time.")) res_id = ids[0] pool_ir_attachment = self.pool.get('ir.attachment') pool_gdoc_config = self.pool.get('google.docs.config') -- cgit v1.2.3