@@ -74,12 +74,11 @@ class google_docs(osv.osv):
|
||||
edit_url_template = 'https://docs.google.com/Edit?docid=%s'
|
||||
prefix_gdoc_id_res = DOCUMENT_LABEL + ':'
|
||||
|
||||
def copy_gdoc(self, cr, uid, model, folder=None, context=None):
|
||||
def copy_gdoc(self, cr, uid, model, context=None):
|
||||
'''Associate a copy of the gdoc identified by 'gdocs_res_id' to the current entity.
|
||||
@param cr: the current row from the database cursor.
|
||||
@param uid: the current user ID, for security checks.
|
||||
@param model: the current model name.
|
||||
@param folder: folder in which to store the copy.
|
||||
@param context: a standard dictionary for contextual values.
|
||||
@return the url of the copy itself.
|
||||
@return -1 if the template hasn't been assigned yet.
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t t-extend="FormView.sidebar.attachments">
|
||||
<t t-jquery="div.oe-binary-file-set" t-operation="append">
|
||||
<button class="button gdoc" type="button">
|
||||
<button class="oe_button" type="button">
|
||||
<img src="/web/static/src/img/throbber.gif" width="16" height="16" style="display: none"/>
|
||||
<span>Add GDoc</span>
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user