[FIX] Fix some field

bzr revid: fme@openerp.com-20120315162107-pcw7ssitur8zb7vv
This commit is contained in:
Fabien Meghazi 2012-03-15 17:21:07 +01:00
parent 8c47efd712
commit 99f956a533
2 changed files with 51 additions and 42 deletions

View File

@ -1050,7 +1050,7 @@ openerp.web.form.Widget = openerp.web.Widget.extend(/** @lends openerp.web.form.
delayOut: 0, delayOut: 0,
fade: true, fade: true,
title: function() { title: function() {
var template = widget.form_template + '.tooltip'; var template = widget.template + '.tooltip';
if (!QWeb.has_template(template)) { if (!QWeb.has_template(template)) {
template = 'WidgetLabel.tooltip'; template = 'WidgetLabel.tooltip';
} }
@ -1541,7 +1541,7 @@ openerp.web.DateWidget = openerp.web.DateTimeWidget.extend({
}); });
openerp.web.form.FieldDatetime = openerp.web.form.Field.extend({ openerp.web.form.FieldDatetime = openerp.web.form.Field.extend({
form_template: "EmptyComponent", template: "EmptyComponent",
build_widget: function() { build_widget: function() {
return new openerp.web.DateTimeWidget(this); return new openerp.web.DateTimeWidget(this);
}, },
@ -1662,10 +1662,10 @@ openerp.web.form.FieldBoolean = openerp.web.form.Field.extend({
}); });
openerp.web.form.FieldProgressBar = openerp.web.form.Field.extend({ openerp.web.form.FieldProgressBar = openerp.web.form.Field.extend({
form_template: 'FieldProgressBar', template: 'FieldProgressBar',
start: function() { start: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.$element.find('div').progressbar({ this.$element.progressbar({
value: this.value, value: this.value,
disabled: this.readonly disabled: this.readonly
}); });
@ -1677,7 +1677,7 @@ openerp.web.form.FieldProgressBar = openerp.web.form.Field.extend({
show_value = 0; show_value = 0;
} }
var formatted_value = openerp.web.format_value(show_value, { type : 'float' }, '0'); var formatted_value = openerp.web.format_value(show_value, { type : 'float' }, '0');
this.$element.find('div').progressbar('option', 'value', show_value).find('span').html(formatted_value + '%'); this.$element.progressbar('option', 'value', show_value).find('span').html(formatted_value + '%');
} }
}); });
@ -1792,7 +1792,7 @@ openerp.web.form.dialog = function(content, options) {
}; };
openerp.web.form.FieldMany2One = openerp.web.form.Field.extend({ openerp.web.form.FieldMany2One = openerp.web.form.Field.extend({
form_template: 'EmptyComponent', template: 'EmptyComponent',
init: function(view, node) { init: function(view, node) {
this._super(view, node); this._super(view, node);
this.previous_readonly = this.is_readonly(); this.previous_readonly = this.is_readonly();
@ -1804,7 +1804,7 @@ openerp.web.form.FieldMany2One = openerp.web.form.Field.extend({
}, },
is_readonly: function() { is_readonly: function() {
return this.readonly || this.force_readonly; return this.readonly || this.force_readonly;
}, },
start: function() { start: function() {
this._super(); this._super();
this.render_content(); this.render_content();
@ -2209,7 +2209,7 @@ var commands = {
} }
}; };
openerp.web.form.FieldOne2Many = openerp.web.form.Field.extend({ openerp.web.form.FieldOne2Many = openerp.web.form.Field.extend({
form_template: 'FieldOne2Many', template: 'FieldOne2Many',
multi_selection: false, multi_selection: false,
init: function(view, node) { init: function(view, node) {
this._super(view, node); this._super(view, node);
@ -2583,7 +2583,7 @@ openerp.web.form.One2ManyFormView = openerp.web.FormView.extend({
}); });
openerp.web.form.FieldMany2Many = openerp.web.form.Field.extend({ openerp.web.form.FieldMany2Many = openerp.web.form.Field.extend({
form_template: 'FieldMany2Many', template: 'FieldMany2Many',
multi_selection: false, multi_selection: false,
init: function(view, node) { init: function(view, node) {
this._super(view, node); this._super(view, node);
@ -3032,7 +3032,7 @@ openerp.web.form.FormOpenDataset = openerp.web.ProxyDataSet.extend({
}); });
openerp.web.form.FieldReference = openerp.web.form.Field.extend({ openerp.web.form.FieldReference = openerp.web.form.Field.extend({
form_template: 'FieldReference', template: 'FieldReference',
init: function(view, node) { init: function(view, node) {
this._super(view, node); this._super(view, node);
this.fields_view = { this.fields_view = {
@ -3078,6 +3078,7 @@ openerp.web.form.FieldReference = openerp.web.form.Field.extend({
}, },
start: function() { start: function() {
this._super(); this._super();
// TODO: not niv compliant
this.selection.$element = $(".oe_form_view_reference_selection", this.$element); this.selection.$element = $(".oe_form_view_reference_selection", this.$element);
this.selection.renderElement(); this.selection.renderElement();
this.selection.start(); this.selection.start();
@ -3191,7 +3192,7 @@ openerp.web.form.FieldBinary = openerp.web.form.Field.extend({
}); });
openerp.web.form.FieldBinaryFile = openerp.web.form.FieldBinary.extend({ openerp.web.form.FieldBinaryFile = openerp.web.form.FieldBinary.extend({
form_template: 'FieldBinaryFile', template: 'FieldBinaryFile',
update_dom: function() { update_dom: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.$element.find('.oe-binary-file-set, .oe-binary-file-clear').toggle(!this.readonly); this.$element.find('.oe-binary-file-set, .oe-binary-file-clear').toggle(!this.readonly);
@ -3229,7 +3230,7 @@ openerp.web.form.FieldBinaryFile = openerp.web.form.FieldBinary.extend({
}); });
openerp.web.form.FieldBinaryImage = openerp.web.form.FieldBinary.extend({ openerp.web.form.FieldBinaryImage = openerp.web.form.FieldBinary.extend({
form_template: 'FieldBinaryImage', template: 'FieldBinaryImage',
start: function() { start: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.$image = this.$element.find('img.oe-binary-image'); this.$image = this.$element.find('img.oe-binary-image');
@ -3270,7 +3271,7 @@ openerp.web.form.FieldBinaryImage = openerp.web.form.FieldBinary.extend({
}); });
openerp.web.form.FieldStatus = openerp.web.form.Field.extend({ openerp.web.form.FieldStatus = openerp.web.form.Field.extend({
form_template: "EmptyComponent", template: "EmptyComponent",
start: function() { start: function() {
this._super(); this._super();
this.selected_value = null; this.selected_value = null;

View File

@ -943,12 +943,14 @@
</ul> </ul>
</t> </t>
<t t-name="FieldChar"> <t t-name="FieldChar">
<input t-att-type="widget.password ? 'password' : 'text'" size="1" <div t-attf-class="oe_form_field_#{type}">
t-att-name="widget.name" <input t-att-type="widget.password ? 'password' : 'text'" size="1"
t-att-id="widget.node.attrs.id" t-att-name="widget.name"
t-attf-class="field_#{widget.type} #{_(['integer', 'float', 'float_time']).contains(widget.type) ? 'oe-number' : ''}" t-att-id="widget.node.attrs.id"
style="width: 100%" t-attf-class="field_#{widget.type} #{_(['integer', 'float', 'float_time']).contains(widget.type) ? 'oe-number' : ''}"
/><img class="oe_field_translate oe_input_icon" t-if="widget.field.translate" t-att-src='_s + "/web/static/src/img/icons/terp-translate.png"' width="16" height="16" border="0"/> style="width: 100%"
/><img class="oe_field_translate oe_input_icon" t-if="widget.field.translate" t-att-src='_s + "/web/static/src/img/icons/terp-translate.png"' width="16" height="16" border="0"/>
</div>
</t> </t>
<t t-name="FieldChar.readonly"> <t t-name="FieldChar.readonly">
<div <div
@ -962,7 +964,7 @@
</div> </div>
</t> </t>
<t t-name="FieldEmail"> <t t-name="FieldEmail">
<table cellpadding="0" cellspacing="0" border="0" width="100%"> <table t-attf-class="oe_form_field_#{type}" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr> <tr>
<td width="100%"> <td width="100%">
<t t-call="FieldChar"/> <t t-call="FieldChar"/>
@ -976,7 +978,7 @@
</table> </table>
</t> </t>
<t t-name="FieldUrl"> <t t-name="FieldUrl">
<table cellpadding="0" cellspacing="0" border="0" width="100%"> <table t-attf-class="oe_form_field_#{type}" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr> <tr>
<td width="100%"> <td width="100%">
<t t-call="FieldChar"/> <t t-call="FieldChar"/>
@ -990,14 +992,16 @@
</table> </table>
</t> </t>
<t t-name="FieldText"> <t t-name="FieldText">
<textarea rows="6" <div t-attf-class="oe_form_field_#{type}">
t-att-name="widget.name" <textarea rows="6"
t-attf-class="field_#{widget.type}" t-att-name="widget.name"
style="width: 100%" t-attf-class="field_#{widget.type}"
></textarea><img class="oe_field_translate oe_input_icon" t-if="widget.field.translate" t-att-src='_s + "/web/static/src/img/icons/terp-translate.png"' width="16" height="16" border="0"/> style="width: 100%"
></textarea><img class="oe_field_translate oe_input_icon" t-if="widget.field.translate" t-att-src='_s + "/web/static/src/img/icons/terp-translate.png"' width="16" height="16" border="0"/>
</div>
</t> </t>
<t t-name="web.datetimepicker"> <t t-name="web.datetimepicker">
<div class="oe_datepicker_root"> <div class="oe_datepicker_root" t-attf-class="oe_form_field_#{type}">
<input type="text" size="1" class="oe_datepicker_container" disabled="disabled" style="display: none;"/> <input type="text" size="1" class="oe_datepicker_container" disabled="disabled" style="display: none;"/>
<input type="text" size="1" style="width: 100%" <input type="text" size="1" style="width: 100%"
t-att-name="widget.name" t-att-name="widget.name"
@ -1007,7 +1011,7 @@
</div> </div>
</t> </t>
<t t-name="FieldSelection"> <t t-name="FieldSelection">
<span class="oe_field_selection"> <div t-attf-class="oe_form_field_#{type}">
<select <select
t-att-name="widget.name" t-att-name="widget.name"
t-att-id="widget.node.attrs.id" t-att-id="widget.node.attrs.id"
@ -1016,10 +1020,10 @@
<option><t t-esc="option[1]"/></option> <option><t t-esc="option[1]"/></option>
</t> </t>
</select> </select>
</span> </div>
</t> </t>
<t t-name="FieldMany2One"> <t t-name="FieldMany2One">
<table cellpadding="0" cellspacing="0" border="0" width="100%"> <table t-attf-class="oe_form_field_#{type}" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr> <tr>
<td width="100%" valign="top"> <td width="100%" valign="top">
<t t-call="FieldChar"/> <t t-call="FieldChar"/>
@ -1056,10 +1060,10 @@
<t t-name="FieldOne2Many"> <t t-name="FieldOne2Many">
</t> </t>
<t t-name="FieldMany2Many"> <t t-name="FieldMany2Many">
<div t-att-id="widget.list_id"></div> <div t-attf-class="oe_form_field_#{type}" t-att-id="widget.list_id"></div>
</t> </t>
<t t-name="FieldReference"> <t t-name="FieldReference">
<table border="0" width="100%" cellpadding="0" cellspacing="0" class="oe_frame oe_forms"> <table t-attf-class="oe_form_field_#{type}" border="0" width="100%" cellpadding="0" cellspacing="0" class="oe_frame oe_forms">
<tr> <tr>
<td t-attf-class="oe_form_frame_cell oe_form_selection oe_form_view_reference_selection"> <td t-attf-class="oe_form_frame_cell oe_form_selection oe_form_view_reference_selection">
</td> </td>
@ -1069,17 +1073,19 @@
</table> </table>
</t> </t>
<t t-name="FieldBoolean"> <t t-name="FieldBoolean">
<input type="checkbox" <div t-attf-class="oe_form_field_#{type}">
t-att-name="widget.name" <input type="checkbox"
t-attf-class="field_#{widget.type}"/> t-att-name="widget.name"
t-attf-class="field_#{widget.type}"/>
</div>
</t> </t>
<t t-name="FieldProgressBar"> <t t-name="FieldProgressBar">
<div t-opentag="true" class="oe-progressbar"> <div t-attf-class="oe_form_field_#{type}" t-opentag="true">
<span></span> <span></span>
</div> </div>
</t> </t>
<t t-name="FieldBinaryImage"> <t t-name="FieldBinaryImage">
<table cellpadding="0" cellspacing="0" border="0"> <table t-attf-class="oe_form_field_#{type}" cellpadding="0" cellspacing="0" border="0">
<tr> <tr>
<td align="center"> <td align="center">
<img t-att-src='_s + "/web/static/src/img/placeholder.png"' class="oe-binary-image" <img t-att-src='_s + "/web/static/src/img/placeholder.png"' class="oe-binary-image"
@ -1128,7 +1134,7 @@
</table> </table>
</t> </t>
<t t-name="FieldBinaryFile"> <t t-name="FieldBinaryFile">
<table cellpadding="0" cellspacing="0" border="0" width="100%"> <table t-attf-class="oe_form_field_#{type}" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr> <tr>
<td width="100%"> <td width="100%">
<input type="text" size="1" readonly="readonly" <input type="text" size="1" readonly="readonly"
@ -1178,10 +1184,12 @@
</table> </table>
</t> </t>
<t t-name="WidgetButton"> <t t-name="WidgetButton">
<button type="button" class="oe_button"> <div t-attf-class="oe_form_field_#{type}">
<img t-if="widget.node.attrs.icon" t-att-src="_s + '/web/static/src/img/icons/' + widget.node.attrs.icon + '.png'" width="16" height="16"/> <button type="button" class="oe_button">
<span t-if="widget.string"><t t-esc="widget.string"/></span> <img t-if="widget.node.attrs.icon" t-att-src="_s + '/web/static/src/img/icons/' + widget.node.attrs.icon + '.png'" width="16" height="16"/>
</button> <span t-if="widget.string"><t t-esc="widget.string"/></span>
</button>
</div>
</t> </t>
<t t-name="WidgetButton.tooltip" t-extend="WidgetLabel.tooltip"> <t t-name="WidgetButton.tooltip" t-extend="WidgetLabel.tooltip">
<t t-jquery="div.oe_tooltip_string" t-operation="replace"> <t t-jquery="div.oe_tooltip_string" t-operation="replace">