diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 3d54aef0fa2..44fcadbf9cc 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -25,7 +25,6 @@ display: none !important; } } - .openerp.openerp_webclient_container { height: 100%; position: relative; @@ -46,7 +45,7 @@ text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); /* http://www.quirksmode.org/dom/inputfile.html * http://stackoverflow.com/questions/2855589/replace-input-type-file-by-an-image - */ */ + */ } .openerp :-moz-placeholder { color: #afafb6 !important; @@ -2294,16 +2293,16 @@ margin-bottom: 32px; 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; } -.openerp .oe_form_editable .oe_form .oe_form_field_float { +.openerp .oe_form_editable .oe_form .oe_form_field_float input { 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; } -.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; } .openerp .oe_hidden_input_file { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 0567d31b1eb..1ab41aa400f 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1822,13 +1822,13 @@ $sheet-max-width: 860px .oe_form_editable .oe_form - .oe_form_field_integer + .oe_form_field_integer input width: 6em !important - .oe_form_field_float + .oe_form_field_float input width: 7em !important - .oe_form_field_date + .oe_form_field_date input width: 7.5em !important - .oe_form_field_datetime + .oe_form_field_datetime input width: 11.5em !important // }}} // FormView.fields_binary {{{ diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 5638d95a3a9..e23510c02f4 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2165,11 +2165,12 @@ instance.web.form.ReinitializeWidgetMixin = { this.initialize_field(); }, initialize_field: function() { - this.on("change:effective_readonly", this, function() { - this.destroy_content(); - this.renderElement(); - this.initialize_content(); - }); + this.on("change:effective_readonly", this, this.reinitialize); + this.initialize_content(); + }, + reinitialize: function() { + this.destroy_content(); + this.renderElement(); this.initialize_content(); }, /** @@ -2190,9 +2191,10 @@ instance.web.form.ReinitializeWidgetMixin = { instance.web.form.ReinitializeFieldMixin = _.extend({}, instance.web.form.ReinitializeWidgetMixin, { initialize_field: function() { 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(); }, /** @@ -2228,7 +2230,7 @@ instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.we if (this.password) { 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() { @@ -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`. * @@ -5020,7 +5053,8 @@ instance.web.form.widgets = new instance.web.Registry({ 'progressbar': 'instance.web.form.FieldProgressBar', 'image': 'instance.web.form.FieldBinaryImage', 'binary': 'instance.web.form.FieldBinaryFile', - 'statusbar': 'instance.web.form.FieldStatus' + 'statusbar': 'instance.web.form.FieldStatus', + 'monetary': 'instance.web.form.FieldMonetary', }); /** diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index bf55db8d7c2..5e8e430e771 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -916,7 +916,7 @@ - + + + + @@ -1717,4 +1720,16 @@ + + + + + + + + + + + +