[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:
parent
58a5e1c013
commit
b4e20f0c14
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue