[IMP] display string label of selection and m2o fields in defaults-setting dialog

bzr revid: xmo@openerp.com-20120209151410-49j13cfbrwwhrp23
This commit is contained in:
Xavier Morel 2012-02-09 16:14:10 +01:00
parent fe31030bd2
commit be5bab60c8
2 changed files with 17 additions and 2 deletions

View File

@ -655,10 +655,25 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
|| field.field.type === 'many2many') {
return false;
}
var displayed;
switch(field.field.type) {
case 'selection':
displayed = _(field.values).find(function (option) {
return option[0] === value;
})[1];
break;
case 'many2one':
displayed = field.value[1] || value;
break;
default:
displayed = value;
}
return {
name: name,
string: field.string,
value: value,
displayed: displayed,
// convert undefined to false
change_default: !!field.field.change_default
}

View File

@ -806,7 +806,7 @@
<option value=""/>
<option t-foreach="args.fields" t-as="field"
t-att-value="field.name">
<t t-esc="field.string"/> = <t t-esc="field.value"/>
<t t-esc="field.string"/> = <t t-esc="field.displayed"/>
</option>
</select>
</td>
@ -823,7 +823,7 @@
<option value=""/>
<option t-foreach="args.conditions" t-as="cond"
t-att-value="cond.name + '=' + cond.value">
<t t-esc="cond.string"/>=<t t-esc="cond.value"/>
<t t-esc="cond.string"/>=<t t-esc="cond.displayed"/>
</option>
</select>
</td>