2012-02-28 08:22:26 +00:00
|
|
|
openerp.google_docs = function(instance, session) {
|
2012-02-27 09:02:24 +00:00
|
|
|
|
|
|
|
instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({
|
2012-02-27 16:12:00 +00:00
|
|
|
init: function() {
|
|
|
|
this._super.apply(this, arguments);
|
2012-03-01 15:09:14 +00:00
|
|
|
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);
|
2012-02-27 09:02:24 +00:00
|
|
|
},
|
2012-03-01 15:09:14 +00:00
|
|
|
on_add_text_gdoc: function() {
|
2012-02-27 09:02:24 +00:00
|
|
|
var self = this;
|
2012-03-01 15:09:14 +00:00
|
|
|
var $gdocbtn = this.$element.find('.oe_google_docs_text_button');
|
2012-02-27 12:38:34 +00:00
|
|
|
$gdocbtn.attr('disabled', 'true').find('img, span').toggle();
|
2012-02-29 17:23:19 +00:00
|
|
|
var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context());
|
2012-03-01 15:09:14 +00:00
|
|
|
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) {
|
2012-02-27 09:02:24 +00:00
|
|
|
self.do_update();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
2012-02-27 15:13:11 +00:00
|
|
|
|