[IMP] copy from pad
bzr revid: rlo@openerp.com-20120227090224-zujpg9zhf2nd5ioe
This commit is contained in:
parent
fd914eb2e3
commit
ebfb0be2e1
|
@ -1,6 +1,18 @@
|
|||
{
|
||||
'name': 'Wiki',
|
||||
'version': '0.1',
|
||||
'author': 'OpenERP SA',
|
||||
'website': 'http://openerp.com',
|
||||
'data': [
|
||||
'res_gdocs.xml'
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
'web': True,
|
||||
'js': ['static/src/js/gdocs.js'],
|
||||
'qweb' : [
|
||||
"static/src/xml/*.xml",
|
||||
],
|
||||
'depends': ['google_base_account'],
|
||||
'description': 'Module to attach a google document to any model.'
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<data>
|
||||
<record id="view_company_form_with_gdocs" model="ir.ui.view">
|
||||
<field name="name">res.company.form.gdocs</field>
|
||||
<field name="model">res.company</field>
|
||||
<field name="model">google.docs</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.view_company_form"/>
|
||||
<field name="arch" type="xml">
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
};
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- vim:fdl=1:
|
||||
-->
|
||||
<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">
|
||||
<img src="/web/static/src/img/throbber.gif" width="16" height="16" style="display: none"/>
|
||||
<span>Add GDoc</span>
|
||||
</button>
|
||||
</t>
|
||||
</t>
|
||||
</templates>
|
Loading…
Reference in New Issue