forked from Techsystech/web
[IMP] Use the options JSON dictionary to encode visibility options
parent
6d76c5f3bd
commit
70ed5cdf59
|
@ -26,8 +26,8 @@
|
||||||
"category": "Tools",
|
"category": "Tools",
|
||||||
"depends": ['web'],
|
"depends": ['web'],
|
||||||
"description": """
|
"description": """
|
||||||
Use the following context keys on fields to hide them in either page or form
|
Use the following boolean switches in the options dictionary on fields to hide
|
||||||
mode:
|
them in either page or form mode:
|
||||||
|
|
||||||
- page_invisible
|
- page_invisible
|
||||||
- form_invisible
|
- form_invisible
|
||||||
|
|
|
@ -7,19 +7,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
openerp.web_mode_visibility = function (openerp) {
|
openerp.web_mode_visibility = function (openerp) {
|
||||||
openerp.web.form.Widget.include({
|
openerp.web.form.Field.include({
|
||||||
|
|
||||||
init: function(view, node) {
|
init: function(view, node) {
|
||||||
this._super(view, node);
|
this._super(view, node);
|
||||||
if (! this.invisible) {
|
if (! this.invisible) {
|
||||||
|
var options = this.get_definition_options();
|
||||||
if (this.view.form_template == "PageView") {
|
if (this.view.form_template == "PageView") {
|
||||||
this.invisible = (this.node.attrs.context &&
|
this.invisible = options.page_invisible;
|
||||||
this.node.attrs.context.page_invisible);
|
|
||||||
}
|
}
|
||||||
else if (this.view.form_template == "FormView") {
|
else if (this.view.form_template == "FormView") {
|
||||||
this.invisible = (this.node.attrs.context &&
|
this.invisible = options.form_invisible;
|
||||||
this.node.attrs.context.form_invisible);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue