From ebfb0be2e156b49a14790300ce746dba78a159d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 10:02:24 +0100 Subject: [IMP] copy from pad bzr revid: rlo@openerp.com-20120227090224-zujpg9zhf2nd5ioe --- addons/google_docs/static/src/js/gdocs.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 addons/google_docs/static/src/js/gdocs.js (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js new file mode 100644 index 00000000000..e605577d45a --- /dev/null +++ b/addons/google_docs/static/src/js/gdocs.js @@ -0,0 +1,29 @@ +openerp.gdocs = function(instance) { + +instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ + on_attachments_loaded: function(attachments) { + this._super(attachments); + var self = this; + var $padbtn = self.$element.find('button.gdocs'); + var is_pad = function(a) { + return a.type == 'url' && a.name == 'GDocs'; + }; + if (_.any(attachments, is_pad)) { + $padbtn.hide(); + } else { + $padbtn.show().click(self.on_add_pad); + } + }, + on_add_pad: function() { + var self = this; + var $padbtn = this.$element.find('button.gdocs'); + $padbtn.attr('disabled', 'true').find('img, span').toggle(); + this.view.dataset.call_button('pad_get', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { + $padbtn.hide(); + self.do_update(); + self.do_action(r.result); + }); + } +}); + +}; -- cgit v1.2.3 From 37ed7a1d9f1819fd39cbf0eb0679ae17e1afd91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 13:38:34 +0100 Subject: [imp] view bzr revid: rlo@openerp.com-20120227123834-todar214ngca7pu0 --- addons/google_docs/static/src/js/gdocs.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index e605577d45a..30edffaad7f 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -4,22 +4,22 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte on_attachments_loaded: function(attachments) { this._super(attachments); var self = this; - var $padbtn = self.$element.find('button.gdocs'); - var is_pad = function(a) { + var $gdocbtn = self.$element.find('button.gdocs'); + var is_gdoc = function(a) { return a.type == 'url' && a.name == 'GDocs'; }; - if (_.any(attachments, is_pad)) { - $padbtn.hide(); + if (_.any(attachments, is_gdoc)) { + $gdocbtn.hide(); } else { - $padbtn.show().click(self.on_add_pad); + $gdocbtn.show().click(self.on_add_gdoc); } }, - on_add_pad: function() { + on_add_gdoc: function() { var self = this; - var $padbtn = this.$element.find('button.gdocs'); - $padbtn.attr('disabled', 'true').find('img, span').toggle(); - this.view.dataset.call_button('pad_get', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { - $padbtn.hide(); + var $gdocbtn = this.$element.find('button.gdocs');alert($gdocbtn); + $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); + this.view.dataset.call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { + $gdocbtn.hide(); self.do_update(); self.do_action(r.result); }); -- cgit v1.2.3 From 95d9cb9f4ec264b0ee35fdc5bef9058d9cfdbe0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 14:54:25 +0100 Subject: [imp] view bzr revid: rlo@openerp.com-20120227135425-879tmcgw20dfy2a1 --- addons/google_docs/static/src/js/gdocs.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 30edffaad7f..579414ee74a 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -2,6 +2,7 @@ openerp.gdocs = function(instance) { instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ on_attachments_loaded: function(attachments) { + alert('gdocs.js.on_attachments_loaded()'); this._super(attachments); var self = this; var $gdocbtn = self.$element.find('button.gdocs'); -- cgit v1.2.3 From 3568bed68046537878e7386597abfb7978de3cdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 16:13:11 +0100 Subject: [imp] view bzr revid: rlo@openerp.com-20120227151311-38go1bn2ihs1n5jq --- addons/google_docs/static/src/js/gdocs.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 579414ee74a..14996da46a5 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -2,7 +2,6 @@ openerp.gdocs = function(instance) { instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ on_attachments_loaded: function(attachments) { - alert('gdocs.js.on_attachments_loaded()'); this._super(attachments); var self = this; var $gdocbtn = self.$element.find('button.gdocs'); @@ -17,7 +16,7 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte }, on_add_gdoc: function() { var self = this; - var $gdocbtn = this.$element.find('button.gdocs');alert($gdocbtn); + var $gdocbtn = this.$element.find('button.gdocs'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); this.view.dataset.call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { $gdocbtn.hide(); @@ -28,3 +27,10 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte }); }; + +$(function() { + console.log($('#gd-button')); + $('#gd-button').click(function(){alert('click');}); + alert('binded'); +} +); -- cgit v1.2.3 From f0a9682a6aa6814817cca4e31fe9561bed60d126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 17:12:00 +0100 Subject: [imp] js things bzr revid: rlo@openerp.com-20120227161200-toovqcewybgxsitg --- addons/google_docs/static/src/js/gdocs.js | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 14996da46a5..11690f70e2a 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,22 +1,16 @@ -openerp.gdocs = function(instance) { +console.log('fegegegwnw') +openerp.google_docs = function(instance) { +console.log('nw') instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ - on_attachments_loaded: function(attachments) { - this._super(attachments); - var self = this; - var $gdocbtn = self.$element.find('button.gdocs'); - var is_gdoc = function(a) { - return a.type == 'url' && a.name == 'GDocs'; - }; - if (_.any(attachments, is_gdoc)) { - $gdocbtn.hide(); - } else { - $gdocbtn.show().click(self.on_add_gdoc); - } + init: function() { + this._super.apply(this, arguments); + this.$element.delegate('.oe_google_docs_button', 'click', self.on_add_gdoc); }, on_add_gdoc: function() { var self = this; - var $gdocbtn = this.$element.find('button.gdocs'); +console.log('--------'); + var $gdocbtn = this.$element.find('.oe_google_docs_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); this.view.dataset.call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { $gdocbtn.hide(); @@ -28,9 +22,3 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte }; -$(function() { - console.log($('#gd-button')); - $('#gd-button').click(function(){alert('click');}); - alert('binded'); -} -); -- cgit v1.2.3 From af04b6860cfe10259a63a44cd6b4a4f8234eed8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 27 Feb 2012 17:14:13 +0100 Subject: [imp] js things bzr revid: rlo@openerp.com-20120227161413-ie6cn7rwoezhht6v --- addons/google_docs/static/src/js/gdocs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 11690f70e2a..6ef889e3fa0 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -5,7 +5,7 @@ console.log('nw') instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ init: function() { this._super.apply(this, arguments); - this.$element.delegate('.oe_google_docs_button', 'click', self.on_add_gdoc); + this.$element.delegate('.oe_google_docs_button', 'click', this.on_add_gdoc); }, on_add_gdoc: function() { var self = this; -- cgit v1.2.3 From ec2ceb5d6bf9c9a12102de64b2eded66cc7c7062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Tue, 28 Feb 2012 09:22:26 +0100 Subject: [imp] js is calling the module bzr revid: rlo@openerp.com-20120228082226-su74ddghivymtp09 --- addons/google_docs/static/src/js/gdocs.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 6ef889e3fa0..32a57e18c0c 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,18 +1,15 @@ -console.log('fegegegwnw') -openerp.google_docs = function(instance) { +openerp.google_docs = function(instance, session) { -console.log('nw') instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ init: function() { this._super.apply(this, arguments); - this.$element.delegate('.oe_google_docs_button', 'click', this.on_add_gdoc); + this.$element.delegate('.oe_google_docs_button', 'click', this.on_add_gdoc); }, on_add_gdoc: function() { var self = this; -console.log('--------'); var $gdocbtn = this.$element.find('.oe_google_docs_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - this.view.dataset.call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { + new openerp.sessions.session0.web.DataSet(this, 'google.docs').call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { $gdocbtn.hide(); self.do_update(); self.do_action(r.result); -- cgit v1.2.3 From f8213e68f0a1d5ffde27a47b70211a0cb205db9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Wed, 29 Feb 2012 09:38:33 +0100 Subject: [imp] integration with google_base_account bzr revid: rlo@openerp.com-20120229083833-yd0wfg8x5ywc9e1c --- addons/google_docs/static/src/js/gdocs.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 32a57e18c0c..6e0ae93fdf3 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -10,6 +10,7 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte var $gdocbtn = this.$element.find('.oe_google_docs_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); new openerp.sessions.session0.web.DataSet(this, 'google.docs').call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { + console.log(r); $gdocbtn.hide(); self.do_update(); self.do_action(r.result); -- cgit v1.2.3 From 4c04da28b7e3c78785cbb51892b26facc1b15f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Wed, 29 Feb 2012 13:29:40 +0100 Subject: [imp] working... the only thing missing is linking from the model web to the gdoc web bzr revid: rlo@openerp.com-20120229122940-16h3bwa6j8zbz01s --- addons/google_docs/static/src/js/gdocs.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 6e0ae93fdf3..14103681306 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -9,11 +9,9 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - new openerp.sessions.session0.web.DataSet(this, 'google.docs').call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { + new openerp.sessions.session0.web.DataSet(this, 'google.docs').call('doc_get', [this.view.datarecord.id, this.view.dataset.get_context()], function(r) { console.log(r); - $gdocbtn.hide(); self.do_update(); - self.do_action(r.result); }); } }); -- cgit v1.2.3 From 1ade3b205fc01dc4d476fa295d8e046a44755b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Wed, 29 Feb 2012 18:23:19 +0100 Subject: [fix] bzr revid: rlo@openerp.com-20120229172319-rzwcu1egrhw9ggms --- addons/google_docs/static/src/js/gdocs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 14103681306..a126bfed5c3 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -9,8 +9,8 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - new openerp.sessions.session0.web.DataSet(this, 'google.docs').call('doc_get', [this.view.datarecord.id, this.view.dataset.get_context()], function(r) { - console.log(r); + var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id]], function(r) { self.do_update(); }); } -- cgit v1.2.3 From 82937d5cc8a812bee3ed4199757417e78f534dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Thu, 1 Mar 2012 16:09:14 +0100 Subject: [imp] add frontend support for spreadsheets and presentations bzr revid: rlo@openerp.com-20120301150914-0733ak0tdhdpaw8h --- addons/google_docs/static/src/js/gdocs.js | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index a126bfed5c3..9723aac2723 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -3,14 +3,34 @@ openerp.google_docs = function(instance, session) { instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ init: function() { this._super.apply(this, arguments); - this.$element.delegate('.oe_google_docs_button', 'click', this.on_add_gdoc); + this.$element.delegate('.oe_google_docs_text_button', 'click', this.on_add_text_gdoc); + this.$element.delegate('.oe_google_docs_spreadsheet_button', 'click', this.on_add_spreadsheet_gdoc); + this.$element.delegate('.oe_google_docs_slide_button', 'click', this.on_add_slide_gdoc); }, - on_add_gdoc: function() { + on_add_text_gdoc: function() { var self = this; - var $gdocbtn = this.$element.find('.oe_google_docs_button'); + var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); - ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id]], function(r) { + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) { + self.do_update(); + }); + }, + on_add_spreadsheet_gdoc: function() { + var self = this; + var $gdocbtn = this.$element.find('.oe_google_docs_spreadsheet_button'); + $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); + var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord, id], 'spreadsheet'], function(r) { + self.do_update(); + }); + }, + on_add_slide_gdoc: function() { + var self = this; + var $gdocbtn = this.$element.find('.oe_google_docs_slide_button'); + $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); + var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord,id], 'slide'], function(r) { self.do_update(); }); } -- cgit v1.2.3 From 2b774dddfb3bd5cfd43fccade36f6ac362ab25d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Fri, 2 Mar 2012 09:15:13 +0100 Subject: [imp] js bzr revid: rlo@openerp.com-20120302081513-mzexq3vw6ftzw45s --- addons/google_docs/static/src/js/gdocs.js | 77 +++++++++++++++++-------------- 1 file changed, 42 insertions(+), 35 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 9723aac2723..825bd577b66 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,40 +1,47 @@ openerp.google_docs = function(instance, session) { -instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ - init: function() { - this._super.apply(this, arguments); - this.$element.delegate('.oe_google_docs_text_button', 'click', this.on_add_text_gdoc); - this.$element.delegate('.oe_google_docs_spreadsheet_button', 'click', this.on_add_spreadsheet_gdoc); - this.$element.delegate('.oe_google_docs_slide_button', 'click', this.on_add_slide_gdoc); - }, - on_add_text_gdoc: function() { - var self = this; - var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); - $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); - ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) { - self.do_update(); - }); - }, - on_add_spreadsheet_gdoc: function() { - var self = this; - var $gdocbtn = this.$element.find('.oe_google_docs_spreadsheet_button'); - $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); - ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord, id], 'spreadsheet'], function(r) { - self.do_update(); - }); - }, - on_add_slide_gdoc: function() { - var self = this; - var $gdocbtn = this.$element.find('.oe_google_docs_slide_button'); - $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); - ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord,id], 'slide'], function(r) { - self.do_update(); - }); - } -}); + instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ + init: function() { + this._super.apply(this, arguments); + this.$element.delegate('.oe_google_docs_text_button', 'click', this.on_add_text_gdoc); + this.$element.delegate('.oe_google_docs_spreadsheet_button', 'click', this.on_add_spreadsheet_gdoc); + this.$element.delegate('.oe_google_docs_slide_button', 'click', this.on_add_slide_gdoc); + }, + on_add_text_gdoc: function() { + console.log('on_add_text_gdoc:'); + var self = this; + var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); + $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); + var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) { + console.log('on_add_text_gdoc: return'); + self.do_update(); + }); + }, + on_add_spreadsheet_gdoc: function() { + console.log('on_add_spreadsheet_gdoc:'); + var self = this; + var $gdocbtn = this.$element.find('.oe_google_docs_spreadsheet_button'); + $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); + var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); + console.log('on_add_spreadsheet_gdoc:'); + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'spreadsheet'], function(r) { + console.log('on_add_spreadsheet_gdoc: return'); + self.do_update(); + }); + }, + on_add_slide_gdoc: function() { + console.log ('on_add_slide_gdoc:'); + var self = this; + var $gdocbtn = this.$element.find('.oe_google_docs_slide_button'); + $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); + var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'slide'], function(r) { + console.log('on_add_slide_gdoc: return'); + self.do_update(); + }); + } + }); }; -- cgit v1.2.3 From ff1fc1a7e9476f33e8a580c0c1f8942e5004bf0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Fri, 2 Mar 2012 11:35:05 +0100 Subject: [imp] bzr revid: rlo@openerp.com-20120302103505-em22nbb5chumfzuf --- addons/google_docs/static/src/js/gdocs.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 825bd577b66..63978868901 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -9,36 +9,40 @@ openerp.google_docs = function(instance, session) { this.$element.delegate('.oe_google_docs_slide_button', 'click', this.on_add_slide_gdoc); }, on_add_text_gdoc: function() { - console.log('on_add_text_gdoc:'); var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) { - console.log('on_add_text_gdoc: return'); + console.log(r); + if (r == 'False') { + var params = { + error: response, + message: "The user google credentials are not set yet. Contact your administrator for help." + } + $(openerp.web.qweb.render("DialogWarning", params)).dialog({ + title: "User Google credentials are not yet set.", + modal: true, + }); + } self.do_update(); }); }, on_add_spreadsheet_gdoc: function() { - console.log('on_add_spreadsheet_gdoc:'); var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_spreadsheet_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); - console.log('on_add_spreadsheet_gdoc:'); ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'spreadsheet'], function(r) { - console.log('on_add_spreadsheet_gdoc: return'); self.do_update(); }); }, on_add_slide_gdoc: function() { - console.log ('on_add_slide_gdoc:'); var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_slide_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'slide'], function(r) { - console.log('on_add_slide_gdoc: return'); self.do_update(); }); } -- cgit v1.2.3 From ebb97da4d16ffdbf74091bc6742f1f175ac0142b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Fri, 16 Mar 2012 10:00:54 +0100 Subject: [fix] fix according to requirements bzr revid: rlo@openerp.com-20120316090054-0datu37ojj98lx13 --- addons/google_docs/static/src/js/gdocs.js | 39 ++++++++++++++----------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 63978868901..b7353fd0bba 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -4,11 +4,24 @@ openerp.google_docs = function(instance, session) { instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ init: function() { this._super.apply(this, arguments); - this.$element.delegate('.oe_google_docs_text_button', 'click', this.on_add_text_gdoc); - this.$element.delegate('.oe_google_docs_spreadsheet_button', 'click', this.on_add_spreadsheet_gdoc); - this.$element.delegate('.oe_google_docs_slide_button', 'click', this.on_add_slide_gdoc); + var self = this; + var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context()); + config.call('get_config', [this.view.dataset.ids[this.view.dataset.index]], function(r) { + console.log(r); + // if the configuration isn't set, the buttons should be hidden. + if (r==false) { + $('.oe_google_docs_text_button').css('display', 'none'); + + return; + } + + var attachment = new instance.web.DataSet(this, 'ir.attachment', self.view.dataset.get_context()); + attachment.call('copy_gdoc', [self.view.dataset.model, [self.view.datarecord.id]], function(res) { + console.log(res); + }); + }); }, - on_add_text_gdoc: function() { + on_add_gdoc: function() { var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); @@ -28,24 +41,6 @@ openerp.google_docs = function(instance, session) { self.do_update(); }); }, - on_add_spreadsheet_gdoc: function() { - var self = this; - var $gdocbtn = this.$element.find('.oe_google_docs_spreadsheet_button'); - $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); - ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'spreadsheet'], function(r) { - self.do_update(); - }); - }, - on_add_slide_gdoc: function() { - var self = this; - var $gdocbtn = this.$element.find('.oe_google_docs_slide_button'); - $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); - ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'slide'], function(r) { - self.do_update(); - }); - } }); }; -- cgit v1.2.3 From 9d5db695ee3e1cfc1f0d306bccf117640a14927b Mon Sep 17 00:00:00 2001 From: MVA Date: Mon, 19 Mar 2012 11:31:32 +0100 Subject: [REF] correct the code and change the view files bzr revid: mva@openerp.com-20120319103132-av7c09avg4p0xgt3 --- addons/google_docs/static/src/js/gdocs.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index b7353fd0bba..c6bc1caa5ed 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -4,6 +4,7 @@ openerp.google_docs = function(instance, session) { instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ init: function() { this._super.apply(this, arguments); + this.$element.delegate('.oe_google_docs_text_button', 'click', this.on_add_text_gdoc); var self = this; var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context()); config.call('get_config', [this.view.dataset.ids[this.view.dataset.index]], function(r) { @@ -21,7 +22,7 @@ openerp.google_docs = function(instance, session) { }); }); }, - on_add_gdoc: function() { + on_add_text_gdoc: function() { var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); -- cgit v1.2.3 From f77cecb90c39041267455b05b23764f85e6783a5 Mon Sep 17 00:00:00 2001 From: MVA Date: Tue, 20 Mar 2012 17:03:20 +0100 Subject: [IMP] add oauth bzr revid: mva@openerp.com-20120320160320-tykxuosgpq1r28ag --- addons/google_docs/static/src/js/gdocs.js | 1 - 1 file changed, 1 deletion(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index c6bc1caa5ed..c32dc4c8829 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -12,7 +12,6 @@ openerp.google_docs = function(instance, session) { // if the configuration isn't set, the buttons should be hidden. if (r==false) { $('.oe_google_docs_text_button').css('display', 'none'); - return; } -- cgit v1.2.3 From d4152e970378881f82373d4e09c8d23eea1d2535 Mon Sep 17 00:00:00 2001 From: MVA Date: Fri, 30 Mar 2012 16:51:49 +0200 Subject: [IMP] change js remove unusfull code and the file name configuration bzr revid: mva@openerp.com-20120330145149-04gqj8lvleb9pa53 --- addons/google_docs/static/src/js/gdocs.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index c32dc4c8829..9dc4f5c88d3 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -8,36 +8,28 @@ openerp.google_docs = function(instance, session) { var self = this; var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context()); config.call('get_config', [this.view.dataset.ids[this.view.dataset.index]], function(r) { - console.log(r); // if the configuration isn't set, the buttons should be hidden. if (r==false) { - $('.oe_google_docs_text_button').css('display', 'none'); + $('.oe_google_docs_text_button',this.$element).hide(); return; } var attachment = new instance.web.DataSet(this, 'ir.attachment', self.view.dataset.get_context()); attachment.call('copy_gdoc', [self.view.dataset.model, [self.view.datarecord.id]], function(res) { - console.log(res); }); }); }, + start: function() { + this._super(); + console.log($('.oe_google_docs_text_button',this.$element)) + $('.oe_google_docs_text_button',this.$element) + }, on_add_text_gdoc: function() { var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) { - console.log(r); - if (r == 'False') { - var params = { - error: response, - message: "The user google credentials are not set yet. Contact your administrator for help." - } - $(openerp.web.qweb.render("DialogWarning", params)).dialog({ - title: "User Google credentials are not yet set.", - modal: true, - }); - } self.do_update(); }); }, -- cgit v1.2.3 From fb989dbfb7161b9f79ce5bf2024a5f13423b1b6f Mon Sep 17 00:00:00 2001 From: MVA Date: Mon, 2 Apr 2012 15:18:17 +0200 Subject: [IMP] change the way to name the attachement and change when you already have a google document the button will be hide bzr revid: mva@openerp.com-20120402131817-oxv227m8i11pfsjx --- addons/google_docs/static/src/js/gdocs.js | 40 +++++++++++++++++-------------- 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 9dc4f5c88d3..425de5045d8 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -5,31 +5,35 @@ openerp.google_docs = function(instance, session) { init: function() { this._super.apply(this, arguments); this.$element.delegate('.oe_google_docs_text_button', 'click', this.on_add_text_gdoc); - var self = this; - var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context()); - config.call('get_config', [this.view.dataset.ids[this.view.dataset.index]], function(r) { - // if the configuration isn't set, the buttons should be hidden. - if (r==false) { - $('.oe_google_docs_text_button',this.$element).hide(); - return; - } - - var attachment = new instance.web.DataSet(this, 'ir.attachment', self.view.dataset.get_context()); - attachment.call('copy_gdoc', [self.view.dataset.model, [self.view.datarecord.id]], function(res) { - }); - }); - }, - start: function() { - this._super(); - console.log($('.oe_google_docs_text_button',this.$element)) - $('.oe_google_docs_text_button',this.$element) }, + + + on_attachments_loaded: function(attachments) { + this._super(attachments); + var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context()); + config.call('get_config', [[this.view.datarecord.id],this.view.dataset.model,this.view.dataset.get_context()], function(r) { + if (r == false){ + $('.oe_google_docs_text_button',this.$element).hide(); + } + }); + }, + on_add_text_gdoc: function() { var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) { + if (r == 'False') { + var params = { + error: response, + message: "The user google credentials are not set yet. Contact your administrator for help." + } + $(openerp.web.qweb.render("DialogWarning", params)).dialog({ + title: "User Google credentials are not yet set.", + modal: true, + }); + } self.do_update(); }); }, -- cgit v1.2.3 From 515af1d3d988af70a833a22ada9edce49dd3c351 Mon Sep 17 00:00:00 2001 From: MVA Date: Tue, 3 Apr 2012 09:07:52 +0200 Subject: [IMP] change the domain to enable spreadsheet and reindentation in the js file bzr revid: mva@openerp.com-20120403070752-4gfw1hg3p6ifzmwi --- addons/google_docs/static/src/js/gdocs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 425de5045d8..a8e941f01f6 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -13,7 +13,7 @@ openerp.google_docs = function(instance, session) { var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context()); config.call('get_config', [[this.view.datarecord.id],this.view.dataset.model,this.view.dataset.get_context()], function(r) { if (r == false){ - $('.oe_google_docs_text_button',this.$element).hide(); + $('.oe_google_docs_text_button',this.$element).hide(); } }); }, -- cgit v1.2.3 From df52a73fc7456a8f0c401b6789e6eb06a177f756 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Tue, 22 May 2012 15:39:44 +0200 Subject: [FIX] google docs new sidebar api bzr revid: al@openerp.com-20120522133944-71thw8qolitv8ft8 --- addons/google_docs/static/src/js/gdocs.js | 49 ++++++++++++------------------- 1 file changed, 19 insertions(+), 30 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index a8e941f01f6..6fe830d383c 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,29 +1,19 @@ -openerp.google_docs = function(instance, session) { - - - instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ - init: function() { - this._super.apply(this, arguments); - this.$element.delegate('.oe_google_docs_text_button', 'click', this.on_add_text_gdoc); - }, - - - on_attachments_loaded: function(attachments) { - this._super(attachments); - var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context()); - config.call('get_config', [[this.view.datarecord.id],this.view.dataset.model,this.view.dataset.get_context()], function(r) { - if (r == false){ - $('.oe_google_docs_text_button',this.$element).hide(); - } - }); - }, - - on_add_text_gdoc: function() { - var self = this; - var $gdocbtn = this.$element.find('.oe_google_docs_text_button'); - $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context()); - ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) { +openerp.google_docs = function(instance, m) { + instance.web.Sidebar = instance.web.Sidebar.extend({ + on_attachments_loaded: function(attachments) { + self._super(attachements); + // if attachment contains a google doc url do nothing + // else + this.sidebar.add_items('other', [ + { label: _t('Google Doc'), callback: self.on_google_doc }, + ]); + }, + on_google_doc: function() { + var self = this; + var form = self.getParent(); + form.sidebar_context().then(function (context) { + var ds = new instance.web.DataSet(this, 'google.docs', context); + ds.call('doc_get', [form.view.dataset.model, [form.view.datarecord.id], 'text'], function(r) { if (r == 'False') { var params = { error: response, @@ -34,9 +24,8 @@ openerp.google_docs = function(instance, session) { modal: true, }); } - self.do_update(); + view.reload(); }); - }, - }); + } + } }; - -- cgit v1.2.3 From ab372e3dcf79744856ee658a0a4107b6cec7395c Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 23 May 2012 11:51:36 +0200 Subject: [IMP] google_docs: reviewed code. Overall cleaning of methods, better documentation, refactoring, fix of some glitches and so on... bzr revid: qdp-launchpad@openerp.com-20120523095136-vj1n9ekukdxibzr2 --- addons/google_docs/static/src/js/gdocs.js | 34 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 6fe830d383c..8f41a9d7b21 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,31 +1,41 @@ openerp.google_docs = function(instance, m) { +var _t = instance.web._t; + instance.web.Sidebar = instance.web.Sidebar.extend({ on_attachments_loaded: function(attachments) { - self._super(attachements); + self = this + self._super(attachments); // if attachment contains a google doc url do nothing - // else - this.sidebar.add_items('other', [ - { label: _t('Google Doc'), callback: self.on_google_doc }, - ]); + // else display a button to create a google doc + var flag = false; + _.each(attachments, function(i) { + if (i.url && i.url.match('/docs.google.com/')) { flag = true; } + }); + if (! flag) { + this.add_items('files', [ + { label: _t('Google Doc'), callback: self.on_google_doc }, + ]); + } }, on_google_doc: function() { var self = this; var form = self.getParent(); form.sidebar_context().then(function (context) { - var ds = new instance.web.DataSet(this, 'google.docs', context); - ds.call('doc_get', [form.view.dataset.model, [form.view.datarecord.id], 'text'], function(r) { + var ds = new instance.web.DataSet(this, 'ir.attachment', context); + ds.call('google_doc_get', [form.dataset.model, [form.datarecord.id], context], function(r) { if (r == 'False') { var params = { error: response, - message: "The user google credentials are not set yet. Contact your administrator for help." + message: _t("The user google credentials are not set yet. Contact your administrator for help.") } $(openerp.web.qweb.render("DialogWarning", params)).dialog({ - title: "User Google credentials are not yet set.", + title: _t("User Google credentials are not yet set."), modal: true, }); } - view.reload(); + form.reload(); }); - } + }) } -}; + }) +} -- cgit v1.2.3 From 7e7ed8ce1859e7a36a70c22eec15296ee9b6d433 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 30 Aug 2012 18:15:31 +0200 Subject: [FIX] google_docs: do not declare self = this as a GLOBAL variable bzr revid: qdp-launchpad@openerp.com-20120830161531-w0it8fda6a2j84vk --- addons/google_docs/static/src/js/gdocs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 8f41a9d7b21..694f5736c72 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -3,7 +3,7 @@ var _t = instance.web._t; instance.web.Sidebar = instance.web.Sidebar.extend({ on_attachments_loaded: function(attachments) { - self = this + var self = this; self._super(attachments); // if attachment contains a google doc url do nothing // else display a button to create a google doc -- cgit v1.2.3 From 6eb82789d60e2200aa075b6c18a2a1d2bc6b34b8 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 26 Sep 2012 16:08:02 +0200 Subject: [IMP] google_docusability improvements bzr revid: qdp-launchpad@openerp.com-20120926140802-b0r0ktkomj6sjchy --- addons/google_docs/static/src/js/gdocs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 694f5736c72..bcfd24f8c0d 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -13,7 +13,7 @@ var _t = instance.web._t; }); if (! flag) { this.add_items('files', [ - { label: _t('Google Doc'), callback: self.on_google_doc }, + { label: _t('Add Google Doc...'), callback: self.on_google_doc }, ]); } }, -- cgit v1.2.3 From 3eb5cfb61b6bbb84043f4fa6b3fdefb0fbb320c7 Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Wed, 3 Oct 2012 16:52:27 +0530 Subject: [IMP]remove call_backs from call method. bzr revid: vme@tinyerp.com-20121003112227-vu2crilmvnk2me8j --- addons/google_docs/static/src/js/gdocs.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index bcfd24f8c0d..2aafdd3de4b 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -22,7 +22,7 @@ var _t = instance.web._t; 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], function(r) { + ds.call('google_doc_get', [form.dataset.model, [form.datarecord.id], context]).then(function(r) { if (r == 'False') { var params = { error: response, @@ -35,7 +35,7 @@ var _t = instance.web._t; } form.reload(); }); - }) + }); } - }) -} + }); +}; -- cgit v1.2.3 From 0b508d66fe8b4b0fb70f22a1f3fee5887913ad06 Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Fri, 12 Oct 2012 19:23:42 +0530 Subject: [IMP] imporve code + usability bzr revid: rgaopenerp-20121012135342-hjj8slov7yvfwal0 --- addons/google_docs/static/src/js/gdocs.js | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index bcfd24f8c0d..c2c0ded407b 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,28 +1,22 @@ openerp.google_docs = function(instance, m) { -var _t = instance.web._t; +var QWeb = instance.web.qweb, + _t = instance.web._t; instance.web.Sidebar = instance.web.Sidebar.extend({ - on_attachments_loaded: function(attachments) { - var self = this; - self._super(attachments); - // if attachment contains a google doc url do nothing - // else display a button to create a google doc - var flag = false; - _.each(attachments, function(i) { - if (i.url && i.url.match('/docs.google.com/')) { flag = true; } + redraw: function() { + var self = this; + this._super.apply(this, arguments); + self.$el.find('.oe_sidebar_add_attachment').after(QWeb.render('Google_doc', {widget: self})) + self.$el.find('.oe_sidebar_add_google_doc').on('click', function (e) { + self.on_google_doc(); }); - if (! flag) { - this.add_items('files', [ - { label: _t('Add Google Doc...'), callback: self.on_google_doc }, - ]); - } }, 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], function(r) { + def = ds.call('google_doc_get', [form.dataset.model, [form.datarecord.id], context], function(r) { if (r == 'False') { var params = { error: response, @@ -33,8 +27,10 @@ var _t = instance.web._t; modal: true, }); } - form.reload(); - }); + + }).done(function(){ + form.reload(); + }); }) } }) -- cgit v1.2.3 From 9932152fae4904e994c74a47f149615b3ca39104 Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Tue, 16 Oct 2012 13:00:53 +0530 Subject: [IMP] add counter on google doc when more than one document attached bzr revid: rgaopenerp-20121016073053-nd6s90drak6crs0a --- addons/google_docs/static/src/js/gdocs.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index a1704cde69c..f293447f2ea 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -3,6 +3,13 @@ var QWeb = instance.web.qweb, _t = instance.web._t; instance.web.Sidebar = instance.web.Sidebar.extend({ + on_attachments_loaded: function(attachments) { + var self = this; + _.chain(attachments) + .filter(function(attachment){ if (attachment.name ==='Google Doc') return true}) + .map(function(attachment, i){ attachment.name = _.str.sprintf(_t("%s (%s)"), attachment.name, i+1)}) + self._super(attachments); + }, redraw: function() { var self = this; this._super.apply(this, arguments); -- cgit v1.2.3 From 7368b52a95524897be9bc511035ad5a6ba28c3e4 Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Tue, 16 Oct 2012 17:12:59 +0530 Subject: [IMP] counter should be apply on multiple section with same name attribute bzr revid: rgaopenerp-20121016114259-9g496xqj8ldal1vk --- addons/google_docs/static/src/js/gdocs.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index f293447f2ea..a0cc7353f3e 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,13 +1,18 @@ openerp.google_docs = function(instance, m) { var QWeb = instance.web.qweb, _t = instance.web._t; - +//{} instance.web.Sidebar = instance.web.Sidebar.extend({ on_attachments_loaded: function(attachments) { var self = this; _.chain(attachments) - .filter(function(attachment){ if (attachment.name ==='Google Doc') return true}) - .map(function(attachment, i){ attachment.name = _.str.sprintf(_t("%s (%s)"), attachment.name, i+1)}) + .groupBy(function(attachment) { return attachment.name}) + .each(function(attachment){ + if(attachment.length > 1) + _.map(attachment, function(attachment, i){ + attachment.name = _.str.sprintf(_t("%s (%s)"), attachment.name, i+1) + }) + }) self._super(attachments); }, redraw: function() { -- cgit v1.2.3 From fee84c9c5d234748912d5ea9b478e72b8986a933 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 17 Oct 2012 12:22:24 +0530 Subject: [FIX] bzr revid: hmo@tinyerp.com-20121017065224-go11e1c1rmvr60vy --- addons/google_docs/static/src/js/gdocs.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index fb9e95c0b63..a7d9074e2c8 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,7 +1,7 @@ openerp.google_docs = function(instance, m) { -var QWeb = instance.web.qweb, - _t = instance.web._t; -//{} +var _t = instance.web._t, + QWeb = instance.web.qweb; + instance.web.Sidebar = instance.web.Sidebar.extend({ on_attachments_loaded: function(attachments) { var self = this; -- cgit v1.2.3 From 99c6701ba55576f0bc0cf2ad03d27cafa1f8a2c3 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 17 Oct 2012 12:40:08 +0530 Subject: [IMP] document: display name with number if more than one attachment has same number bzr revid: hmo@tinyerp.com-20121017071008-1khlntrrdi7cxgao --- addons/google_docs/static/src/js/gdocs.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index a7d9074e2c8..1cdb22aeb41 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -2,23 +2,11 @@ openerp.google_docs = function(instance, m) { var _t = instance.web._t, QWeb = instance.web.qweb; - instance.web.Sidebar = instance.web.Sidebar.extend({ - on_attachments_loaded: function(attachments) { - var self = this; - _.chain(attachments) - .groupBy(function(attachment) { return attachment.name}) - .each(function(attachment){ - if(attachment.length > 1) - _.map(attachment, function(attachment, i){ - attachment.name = _.str.sprintf(_t("%s (%s)"), attachment.name, i+1) - }) - }) - self._super(attachments); - }, + instance.web.Sidebar.include({ redraw: function() { var self = this; this._super.apply(this, arguments); - self.$el.find('.oe_sidebar_add_attachment').after(QWeb.render('Google_doc', {widget: self})) + self.$el.find('.oe_sidebar_add_attachment').after(QWeb.render('AddGoogleDocumentItem', {widget: self})) self.$el.find('.oe_sidebar_add_google_doc').on('click', function (e) { self.on_google_doc(); }); -- 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/static/src/js/gdocs.js | 35 +++++++++++++++++-------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') 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(); + }); }); - }); + } } }); }; -- cgit v1.2.3 From a2715888c16f519d531a5aa77f0034791e330758 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 31 Oct 2012 11:31:48 +0100 Subject: [IMP] jQuery deferred API changes refactoring. Changed 'then's in 'done'/'fail' and 'pipe's in 'then' bzr revid: fme@openerp.com-20121031103148-r1slfpl2kcnajjd3 --- addons/google_docs/static/src/js/gdocs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 2aafdd3de4b..6e3f30a2c1f 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -20,9 +20,9 @@ var _t = instance.web._t; on_google_doc: function() { var self = this; var form = self.getParent(); - form.sidebar_context().then(function (context) { + form.sidebar_context().done(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) { + ds.call('google_doc_get', [form.dataset.model, [form.datarecord.id], context]).done(function(r) { if (r == 'False') { var params = { error: response, -- cgit v1.2.3 From 08e37a27580d8322311dd8f27c082293ca7548b9 Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Thu, 1 Nov 2012 12:48:46 +0530 Subject: [IMP]: meaningful google doc name and newly created google document open in new tab. bzr revid: tta@openerp.com-20121101071846-i9k3jfa8bdzfwvu9 --- addons/google_docs/static/src/js/gdocs.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 6e8ff59f377..3a14e1f4ad6 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -30,6 +30,7 @@ var _t = instance.web._t, }); } }).done(function(){ + window.open(r.url,"_blank"); view.reload(); }); }); -- cgit v1.2.3 From dc015a8be2c62468ca0d353f8ba2315370485ae0 Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Thu, 1 Nov 2012 14:50:13 +0530 Subject: [FIX] corrected code for opening new google doc. bzr revid: tta@openerp.com-20121101092013-ks4hfd3cjj9trw8s --- addons/google_docs/static/src/js/gdocs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/google_docs/static/src/js/gdocs.js') diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 3a14e1f4ad6..0cc93b2510c 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -29,7 +29,7 @@ var _t = instance.web._t, modal: true, }); } - }).done(function(){ + }).done(function(r){ window.open(r.url,"_blank"); view.reload(); }); -- cgit v1.2.3