[IMP] move and rename ListView.List.get_fields_view: its actual role is to transmogrify the listview's view descriptor so that we can use it in a form view, so it's only for editable lists, and it should reflect its actual task in its name.
Also add some doc. bzr revid: xmo@openerp.com-20110623105002-vnznqit790p5gv48
This commit is contained in:
parent
e8526ae9f1
commit
3099c30221
|
@ -116,6 +116,23 @@ openerp.base.list.editable = function (openerp) {
|
|||
delete this.edition_index;
|
||||
delete this.edition;
|
||||
},
|
||||
/**
|
||||
* Adapts this list's view description to be suitable to the inner form view of a row being edited.
|
||||
*
|
||||
* @returns {Object} fields_view_get's view section suitable for putting into form view of editable rows.
|
||||
*/
|
||||
get_form_fields_view: function () {
|
||||
// deep copy of view
|
||||
var view = $.extend(true, {}, this.group.view.fields_view);
|
||||
_(view.arch.children).each(function (widget) {
|
||||
widget.attrs.nolabel = true;
|
||||
if (widget.tag === 'button') {
|
||||
delete widget.attrs.string;
|
||||
}
|
||||
});
|
||||
view.arch.attrs.col = 2 * view.arch.children.length;
|
||||
return view;
|
||||
},
|
||||
render_row_as_form: function (row) {
|
||||
this.cancel_pending_edition();
|
||||
|
||||
|
@ -161,7 +178,7 @@ openerp.base.list.editable = function (openerp) {
|
|||
template: 'ListView.row.form',
|
||||
registry: openerp.base.list.form.widgets
|
||||
});
|
||||
$.when(this.edition_form.on_loaded({fields_view: this.get_fields_view()})).then(function () {
|
||||
$.when(this.edition_form.on_loaded({fields_view: this.get_form_fields_view()})).then(function () {
|
||||
// put in $.when just in case FormView.on_loaded becomes asynchronous
|
||||
$new_row.find('td')
|
||||
.addClass('oe-field-cell')
|
||||
|
|
|
@ -574,18 +574,6 @@ openerp.base.ListView.List = Class.extend( /** @lends openerp.base.ListView.List
|
|||
this.$current = this.$_element.clone(true);
|
||||
this.$current.empty().append(QWeb.render('ListView.rows', this));
|
||||
},
|
||||
get_fields_view: function () {
|
||||
// deep copy of view
|
||||
var view = $.extend(true, {}, this.group.view.fields_view);
|
||||
_(view.arch.children).each(function (widget) {
|
||||
widget.attrs.nolabel = true;
|
||||
if (widget.tag === 'button') {
|
||||
delete widget.attrs.string;
|
||||
}
|
||||
});
|
||||
view.arch.attrs.col = 2 * view.arch.children.length;
|
||||
return view;
|
||||
},
|
||||
/**
|
||||
* Gets the ids of all currently selected records, if any
|
||||
* @returns {Object} object with the keys ``ids`` and ``records``, holding respectively the ids of all selected records and the records themselves.
|
||||
|
|
Loading…
Reference in New Issue