added field monetary
bzr revid: nicolas.vanhoren@openerp.com-20121008152831-7r4ow3ljuxvedm7v
This commit is contained in:
parent
06fd81019c
commit
57cc1e3329
|
@ -25,7 +25,6 @@
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.openerp.openerp_webclient_container {
|
.openerp.openerp_webclient_container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -46,7 +45,7 @@
|
||||||
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
|
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
|
||||||
/* http://www.quirksmode.org/dom/inputfile.html
|
/* http://www.quirksmode.org/dom/inputfile.html
|
||||||
* http://stackoverflow.com/questions/2855589/replace-input-type-file-by-an-image
|
* http://stackoverflow.com/questions/2855589/replace-input-type-file-by-an-image
|
||||||
*/ */
|
*/
|
||||||
}
|
}
|
||||||
.openerp :-moz-placeholder {
|
.openerp :-moz-placeholder {
|
||||||
color: #afafb6 !important;
|
color: #afafb6 !important;
|
||||||
|
@ -2294,16 +2293,16 @@
|
||||||
margin-bottom: 32px;
|
margin-bottom: 32px;
|
||||||
text-align: justify;
|
text-align: justify;
|
||||||
}
|
}
|
||||||
.openerp .oe_form_editable .oe_form .oe_form_field_integer {
|
.openerp .oe_form_editable .oe_form .oe_form_field_integer input {
|
||||||
width: 6em !important;
|
width: 6em !important;
|
||||||
}
|
}
|
||||||
.openerp .oe_form_editable .oe_form .oe_form_field_float {
|
.openerp .oe_form_editable .oe_form .oe_form_field_float input {
|
||||||
width: 7em !important;
|
width: 7em !important;
|
||||||
}
|
}
|
||||||
.openerp .oe_form_editable .oe_form .oe_form_field_date {
|
.openerp .oe_form_editable .oe_form .oe_form_field_date input {
|
||||||
width: 7.5em !important;
|
width: 7.5em !important;
|
||||||
}
|
}
|
||||||
.openerp .oe_form_editable .oe_form .oe_form_field_datetime {
|
.openerp .oe_form_editable .oe_form .oe_form_field_datetime input {
|
||||||
width: 11.5em !important;
|
width: 11.5em !important;
|
||||||
}
|
}
|
||||||
.openerp .oe_hidden_input_file {
|
.openerp .oe_hidden_input_file {
|
||||||
|
|
|
@ -1822,13 +1822,13 @@ $sheet-max-width: 860px
|
||||||
|
|
||||||
.oe_form_editable
|
.oe_form_editable
|
||||||
.oe_form
|
.oe_form
|
||||||
.oe_form_field_integer
|
.oe_form_field_integer input
|
||||||
width: 6em !important
|
width: 6em !important
|
||||||
.oe_form_field_float
|
.oe_form_field_float input
|
||||||
width: 7em !important
|
width: 7em !important
|
||||||
.oe_form_field_date
|
.oe_form_field_date input
|
||||||
width: 7.5em !important
|
width: 7.5em !important
|
||||||
.oe_form_field_datetime
|
.oe_form_field_datetime input
|
||||||
width: 11.5em !important
|
width: 11.5em !important
|
||||||
// }}}
|
// }}}
|
||||||
// FormView.fields_binary {{{
|
// FormView.fields_binary {{{
|
||||||
|
|
|
@ -2165,11 +2165,12 @@ instance.web.form.ReinitializeWidgetMixin = {
|
||||||
this.initialize_field();
|
this.initialize_field();
|
||||||
},
|
},
|
||||||
initialize_field: function() {
|
initialize_field: function() {
|
||||||
this.on("change:effective_readonly", this, function() {
|
this.on("change:effective_readonly", this, this.reinitialize);
|
||||||
this.destroy_content();
|
this.initialize_content();
|
||||||
this.renderElement();
|
},
|
||||||
this.initialize_content();
|
reinitialize: function() {
|
||||||
});
|
this.destroy_content();
|
||||||
|
this.renderElement();
|
||||||
this.initialize_content();
|
this.initialize_content();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -2190,9 +2191,10 @@ instance.web.form.ReinitializeWidgetMixin = {
|
||||||
instance.web.form.ReinitializeFieldMixin = _.extend({}, instance.web.form.ReinitializeWidgetMixin, {
|
instance.web.form.ReinitializeFieldMixin = _.extend({}, instance.web.form.ReinitializeWidgetMixin, {
|
||||||
initialize_field: function() {
|
initialize_field: function() {
|
||||||
instance.web.form.ReinitializeWidgetMixin.initialize_field.call(this);
|
instance.web.form.ReinitializeWidgetMixin.initialize_field.call(this);
|
||||||
this.on("change:effective_readonly", this, function() {
|
this.render_value();
|
||||||
this.render_value();
|
},
|
||||||
});
|
reinitialize: function() {
|
||||||
|
instance.web.form.ReinitializeWidgetMixin.reinitialize.call(this);
|
||||||
this.render_value();
|
this.render_value();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -2228,7 +2230,7 @@ instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.we
|
||||||
if (this.password) {
|
if (this.password) {
|
||||||
show_value = new Array(show_value.length + 1).join('*');
|
show_value = new Array(show_value.length + 1).join('*');
|
||||||
}
|
}
|
||||||
this.$el.text(show_value);
|
this.$(".oe_form_char_content").text(show_value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
is_syntax_valid: function() {
|
is_syntax_valid: function() {
|
||||||
|
@ -4990,6 +4992,37 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
instance.web.form.FieldMonetary = instance.web.form.FieldFloat.extend({
|
||||||
|
template: "FieldMonetary",
|
||||||
|
init: function() {
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
this.set({"currency": false});
|
||||||
|
if (this.options.currency_field) {
|
||||||
|
this.field_manager.on("field_changed:" + this.options.currency_field, this, function() {
|
||||||
|
this.set({"currency": this.field_manager.get_field_value(this.options.currency_field)});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.on("change:currency", this, this.get_currency_info);
|
||||||
|
this.get_currency_info();
|
||||||
|
this.ci_dm = new instance.web.DropMisordered();
|
||||||
|
},
|
||||||
|
start: function() {
|
||||||
|
var tmp = this._super();
|
||||||
|
this.on("change:currency_info", this, this.reinitialize);
|
||||||
|
return tmp;
|
||||||
|
},
|
||||||
|
get_currency_info: function() {
|
||||||
|
var self = this;
|
||||||
|
if (this.get("currency") === false) {
|
||||||
|
this.set({"currency_info": null});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return this.ci_dm.add(new instance.web.Model("res.currency").query(["symbol", "position"]).first()).pipe(function(res) {
|
||||||
|
self.set({"currency_info": res});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registry of form fields, called by :js:`instance.web.FormView`.
|
* Registry of form fields, called by :js:`instance.web.FormView`.
|
||||||
*
|
*
|
||||||
|
@ -5020,7 +5053,8 @@ instance.web.form.widgets = new instance.web.Registry({
|
||||||
'progressbar': 'instance.web.form.FieldProgressBar',
|
'progressbar': 'instance.web.form.FieldProgressBar',
|
||||||
'image': 'instance.web.form.FieldBinaryImage',
|
'image': 'instance.web.form.FieldBinaryImage',
|
||||||
'binary': 'instance.web.form.FieldBinaryFile',
|
'binary': 'instance.web.form.FieldBinaryFile',
|
||||||
'statusbar': 'instance.web.form.FieldStatus'
|
'statusbar': 'instance.web.form.FieldStatus',
|
||||||
|
'monetary': 'instance.web.form.FieldMonetary',
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -916,7 +916,7 @@
|
||||||
</t>
|
</t>
|
||||||
<t t-name="FieldChar">
|
<t t-name="FieldChar">
|
||||||
<span t-att-class="'oe_form_field '+widget.widget_class" t-att-style="widget.node.attrs.style">
|
<span t-att-class="'oe_form_field '+widget.widget_class" t-att-style="widget.node.attrs.style">
|
||||||
<t t-if="!widget.get('effective_readonly')">
|
<t t-if="!widget.get('effective_readonly')">
|
||||||
<input t-att-type="widget.password ? 'password' : 'text'"
|
<input t-att-type="widget.password ? 'password' : 'text'"
|
||||||
t-att-id="widget.id_for_label"
|
t-att-id="widget.id_for_label"
|
||||||
t-att-tabindex="widget.node.attrs.tabindex"
|
t-att-tabindex="widget.node.attrs.tabindex"
|
||||||
|
@ -925,6 +925,9 @@
|
||||||
t-att-maxlength="widget.field.size"
|
t-att-maxlength="widget.field.size"
|
||||||
/><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"/>
|
/><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"/>
|
||||||
</t>
|
</t>
|
||||||
|
<t t-if="widget.get('effective_readonly')">
|
||||||
|
<span class="oe_form_char_content"></span>
|
||||||
|
</t>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
<t t-name="FieldEmail">
|
<t t-name="FieldEmail">
|
||||||
|
@ -1717,4 +1720,16 @@
|
||||||
<button class="oe_form_m2o_sc_button oe_button">Add All Info...</button>
|
<button class="oe_form_m2o_sc_button oe_button">Add All Info...</button>
|
||||||
<button class="oe_form_m2o_cancel_button oe_button">Cancel</button>
|
<button class="oe_form_m2o_cancel_button oe_button">Cancel</button>
|
||||||
</t>
|
</t>
|
||||||
|
<t t-name="FieldMonetary" t-extend="FieldChar">
|
||||||
|
<t t-jquery="t:first" t-operation="before">
|
||||||
|
<t t-if="widget.get('currency_info') and widget.get('currency_info').position === 'before'">
|
||||||
|
<t t-esc="widget.get('currency_info').symbol"/>
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
|
<t t-jquery="t:last" t-operation="after">
|
||||||
|
<t t-if="widget.get('currency_info') and widget.get('currency_info').position === 'after'">
|
||||||
|
<t t-esc="widget.get('currency_info').symbol"/>
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
</templates>
|
</templates>
|
||||||
|
|
Loading…
Reference in New Issue