[FIX] Password fields values are not hidden

lp bug: https://launchpad.net/bugs/880804 fixed

bzr revid: fme@openerp.com-20111025185030-vw69honpjoaekh2v
This commit is contained in:
Fabien Meghazi 2011-10-25 20:50:30 +02:00
parent 17dfb2256d
commit de31afa995
2 changed files with 12 additions and 1 deletions

View File

@ -1170,6 +1170,10 @@ openerp.web.form.Field = openerp.web.form.Widget.extend(/** @lends openerp.web.f
openerp.web.form.FieldChar = openerp.web.form.Field.extend({
template: 'FieldChar',
init: function (view, node) {
this._super(view, node);
this.password = this.node.attrs.password === 'True' || this.node.attrs.password === '1';
},
start: function() {
this._super.apply(this, arguments);
this.$element.find('input').change(this.on_ui_change);
@ -2858,9 +2862,16 @@ openerp.web.form.FieldReadonly = openerp.web.form.Field.extend({
});
openerp.web.form.FieldCharReadonly = openerp.web.form.FieldReadonly.extend({
template: 'FieldChar.readonly',
init: function(view, node) {
this._super(view, node);
this.password = this.node.attrs.password === 'True' || this.node.attrs.password === '1';
},
set_value: function (value) {
this._super.apply(this, arguments);
var show_value = openerp.web.format_value(value, this, '');
if (this.password) {
show_value = new Array(show_value.length + 1).join('*');
}
this.$element.find('div').text(show_value);
return show_value;
}

View File

@ -763,7 +763,7 @@
<p class="oe_form_paragraph"><t t-esc="widget.string"/></p>
</t>
<t t-name="FieldChar">
<input type="text" size="1"
<input t-att-type="widget.password ? 'password' : 'text'" size="1"
t-att-name="widget.name"
t-att-id="widget.element_id"
t-attf-class="field_#{widget.type}"