diff options
| author | TTA <> | 2012-10-19 16:10:20 +0530 |
|---|---|---|
| committer | Vijaykumar Baladaniya <vba@tinyerp.com> | 2012-10-19 16:10:20 +0530 |
| commit | 3da067914a9f2e3574213f2aba492c45bfb55d8d (patch) | |
| tree | 7ab5afb71b62bd921082d22ccf700d7f2c0e877f /addons/google_docs | |
| parent | 99c6701ba55576f0bc0cf2ad03d27cafa1f8a2c3 (diff) | |
Fixed list view issue.
bzr revid: vba@tinyerp.com-20121019104020-9tz7t6h7xwa4dali
Diffstat (limited to 'addons/google_docs')
| -rw-r--r-- | addons/google_docs/google_docs.py | 3 | ||||
| -rw-r--r-- | addons/google_docs/static/src/js/gdocs.js | 35 |
2 files changed, 21 insertions, 17 deletions
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') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 1cdb22aeb41..6e8ff59f377 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -13,24 +13,27 @@ var _t = instance.web._t, }, on_google_doc: function() { var self = this; - var form = self.getParent(); - form.sidebar_context().then(function (context) { - var ds = new instance.web.DataSet(this, 'ir.attachment', context); - ds.call('google_doc_get', [form.dataset.model, [form.datarecord.id], context]).then(function(r) { - if (r == 'False') { - var params = { - error: response, - message: _t("The user google credentials are not set yet. Contact your administrator for help.") + var view = self.getParent(); + var ids = ( view.fields_view.type != "form" )? view.groups.get_selection().ids : [ view.datarecord.id ]; + if( !_.isEmpty(ids) ){ + view.sidebar_context().then(function (context) { + var ds = new instance.web.DataSet(this, 'ir.attachment', context); + ds.call('google_doc_get', [view.dataset.model, ids, context]).then(function(r) { + if (r == 'False') { + var params = { + error: response, + message: _t("The user google credentials are not set yet. Contact your administrator for help.") + } + $(openerp.web.qweb.render("DialogWarning", params)).dialog({ + title: _t("User Google credentials are not yet set."), + modal: true, + }); } - $(openerp.web.qweb.render("DialogWarning", params)).dialog({ - title: _t("User Google credentials are not yet set."), - modal: true, - }); - } - }).done(function(){ - form.reload(); + }).done(function(){ + view.reload(); + }); }); - }); + } } }); }; |
