[IMP] Improved binary file display
bzr revid: fme@openerp.com-20111215120415-2wwzywko3qyg0bvj
This commit is contained in:
parent
e397be178b
commit
63296c0142
|
@ -2909,13 +2909,18 @@ openerp.web.form.FieldBinaryFile = openerp.web.form.FieldBinary.extend({
|
||||||
},
|
},
|
||||||
set_value: function(value) {
|
set_value: function(value) {
|
||||||
this._super.apply(this, arguments);
|
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);
|
this.$element.find('input').eq(0).val(show_value);
|
||||||
},
|
},
|
||||||
on_file_uploaded_and_valid: function(size, name, content_type, file_base64) {
|
on_file_uploaded_and_valid: function(size, name, content_type, file_base64) {
|
||||||
this.value = file_base64;
|
this.value = file_base64;
|
||||||
this.binary_value = true;
|
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.$element.find('input').eq(0).val(show_value);
|
||||||
this.set_filename(name);
|
this.set_filename(name);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1065,7 +1065,7 @@
|
||||||
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td width="100%">
|
<td width="100%">
|
||||||
<input type="text" size="1"
|
<input type="text" size="1" readonly="readonly"
|
||||||
t-att-name="widget.name"
|
t-att-name="widget.name"
|
||||||
t-att-id="widget.element_id + '_field'"
|
t-att-id="widget.element_id + '_field'"
|
||||||
t-attf-class="field_#{widget.type}" style="width: 100%"
|
t-attf-class="field_#{widget.type}" style="width: 100%"
|
||||||
|
|
Loading…
Reference in New Issue