summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2014-05-05 16:51:38 +0200
committerThibault Delavallée <tde@openerp.com>2014-05-05 16:51:38 +0200
commit80c77d0355b60f578beabd2c3f87285e24d22222 (patch)
tree1bcaf29051079908fed33e627c3f56fc8941400f /addons/web/static/src
parent272b71b2a0e2fcf777ad2e6004374892b06892e3 (diff)
[FIX] web: view_form: fixed effective_readonly behavior of the
binary multi files widget. The option to add an attachment should be available only in edit mode. lp bug: https://launchpad.net/bugs/1314974 fixed bzr revid: tde@openerp.com-20140505145138-x9iwzp74ha2q0bp2
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/view_form.js6
-rw-r--r--addons/web/static/src/xml/base.xml2
2 files changed, 6 insertions, 2 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 6014e83dba1..d93b59bc520 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -5408,7 +5408,7 @@ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({
* Options on attribute ; "blockui" {Boolean} block the UI or not
* during the file is uploading
*/
-instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractField.extend({
+instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, {
template: "FieldBinaryFileUploader",
init: function(field_manager, node) {
this._super(field_manager, node);
@@ -5426,6 +5426,9 @@ instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractFie
start: function() {
this._super(this);
this.$el.on('change', 'input.oe_form_binary_file', this.on_file_change );
+ this.on("change:effective_readonly", this, function () {
+ this.render_value();
+ });
},
set_value: function(value_) {
value_ = value_ || [];
@@ -5462,6 +5465,7 @@ instance.web.form.FieldMany2ManyBinaryMultiFiles = instance.web.form.AbstractFie
},
render_value: function () {
var self = this;
+ this.$('.oe_add').css('visibility', this.get('effective_readonly') ? 'hidden': '');
this.read_name_values().then(function (ids) {
var render = $(instance.web.qweb.render('FieldBinaryFileUploader.files', {'widget': self, 'values': ids}));
render.on('click', '.oe_delete', _.bind(self.on_file_delete, self));
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 82a3822a9c8..bda1a2b8fc3 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -1336,7 +1336,7 @@
<t t-name="FieldBinaryFileUploader">
<div t-att-style="widget.node.attrs.style" t-attf-class="oe_fileupload #{widget.node.attrs.class ? widget.node.attrs.class :''}">
<div class="oe_placeholder_files"/>
- <div class="oe_add" t-if="!widget.get('effective_readonly')">
+ <div class="oe_add">
<!-- uploader of file -->
<button class="oe_attach"><span class="oe_e">'</span></button>
<span class='oe_attach_label'><t t-esc="widget.string"/></span>