[MERGE] [FIX] reference field: correct editable tree view for refrence field (opw 601553)

bzr revid: mat@openerp.com-20140115110038-30hgekee12evx5fm
This commit is contained in:
Martin Trigaux 2014-01-15 12:00:38 +01:00
commit 2170efe270
3 changed files with 20 additions and 1 deletions

View File

@ -2850,6 +2850,9 @@
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_datetime input.oe_datepicker_master, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_date input.oe_datepicker_master {
width: 100% !important;
}
.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_reference {
display: table;
}
.openerp .oe_list_group_name {
white-space: nowrap;
}

View File

@ -2243,6 +2243,8 @@ $sheet-padding: 16px
&.oe_form_field_datetime,&.oe_form_field_date
input.oe_datepicker_master
width: 100% !important
&.oe_form_field_reference
display: table
.oe_list_group_name
white-space: nowrap
// }}}

View File

@ -1022,7 +1022,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
id = parseInt(ref_match[2], 10);
new instance.web.DataSet(this.view, model).name_get([id]).done(function(names) {
if (!names.length) { return; }
record.set(column.id, names[0][1]);
record.set(column.id + '__display', names[0][1]);
});
}
} else if (column.type === 'many2one') {
@ -2095,6 +2095,7 @@ instance.web.list.columns = new instance.web.Registry({
'field.handle': 'instance.web.list.Handle',
'button': 'instance.web.list.Button',
'field.many2onebutton': 'instance.web.list.Many2OneButton',
'field.reference': 'instance.web.list.Reference',
'field.many2many': 'instance.web.list.Many2Many'
});
instance.web.list.columns.for_ = function (id, field, node) {
@ -2307,5 +2308,18 @@ instance.web.list.Many2Many = instance.web.list.Column.extend({
return this._super(row_data, options);
}
});
instance.web.list.Reference = instance.web.list.Column.extend({
_format: function (row_data, options) {
if (!_.isEmpty(row_data[this.id].value)) {
// If value, use __display version for printing
if (!!row_data[this.id + '__display']) {
row_data[this.id] = row_data[this.id + '__display'];
} else {
row_data[this.id] = {'value': ''};
}
}
return this._super(row_data, options);
}
});
};
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax: