[IMP] use list.Column's parsed (and potentially altered) modifiers to generate the edition form view

This way, listview 'widgets' can alter the modifiers object and influence the corresponding form widget

bzr revid: xmo@openerp.com-20120904115627-v626hcb9o0s7bcrp
This commit is contained in:
Xavier Morel 2012-09-04 13:56:27 +02:00
parent 58a5e1c013
commit b4e20f0c14
2 changed files with 16 additions and 8 deletions

View File

@ -2115,6 +2115,11 @@ instance.web.list.ProgressBar = instance.web.list.Column.extend({
}
});
instance.web.list.Handle = instance.web.list.Column.extend({
init: function () {
this._super.apply(this, arguments);
// Handle overrides the field to not be form-editable.
this.modifiers.readonly = true;
},
/**
* Return styling hooks for a drag handle
*

View File

@ -354,14 +354,17 @@ openerp.web.list_editable = function (instance) {
'class': 'oe_form_container',
version: '7.0'
});
_(view.arch.children).each(function (widget) {
var modifiers = JSON.parse(widget.attrs.modifiers || '{}');
widget.attrs.nolabel = true;
if (modifiers['tree_invisible'] || widget.tag === 'button') {
modifiers.invisible = true;
}
widget.attrs.modifiers = JSON.stringify(modifiers);
});
_(view.arch.children).chain()
.zip(this.columns)
.each(function (ar) {
var widget = ar[0], column = ar[1];
var modifiers = _.extend({}, column.modifiers);
widget.attrs.nolabel = true;
if (modifiers['tree_invisible'] || widget.tag === 'button') {
modifiers.invisible = true;
}
widget.attrs.modifiers = JSON.stringify(modifiers);
});
return view;
},
handle_onwrite: function (source_record) {