[IMP] Improved binary file display

bzr revid: fme@openerp.com-20111215120415-2wwzywko3qyg0bvj
This commit is contained in:
Fabien Meghazi 2011-12-15 13:04:15 +01:00
parent e397be178b
commit 63296c0142
2 changed files with 8 additions and 3 deletions

View File

@ -2909,13 +2909,18 @@ openerp.web.form.FieldBinaryFile = openerp.web.form.FieldBinary.extend({
},
set_value: function(value) {
this._super.apply(this, arguments);
var show_value = (value != null && value !== false) ? value : '';
var show_value;
if (this.node.attrs.filename) {
show_value = this.view.datarecord[this.node.attrs.filename] || '';
} else {
show_value = (value != null && value !== false) ? value : '';
}
this.$element.find('input').eq(0).val(show_value);
},
on_file_uploaded_and_valid: function(size, name, content_type, file_base64) {
this.value = file_base64;
this.binary_value = true;
var show_value = this.human_filesize(size);
var show_value = name + " (" + this.human_filesize(size) + ")";
this.$element.find('input').eq(0).val(show_value);
this.set_filename(name);
},

View File

@ -1065,7 +1065,7 @@
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="100%">
<input type="text" size="1"
<input type="text" size="1" readonly="readonly"
t-att-name="widget.name"
t-att-id="widget.element_id + '_field'"
t-attf-class="field_#{widget.type}" style="width: 100%"