mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[ADD] Module for field visibility by view mode
This commit is contained in:
25
web_mode_visibility/static/src/js/web_mode_visibility.js
Normal file
25
web_mode_visibility/static/src/js/web_mode_visibility.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
|
||||
Copyright (C) 2013 Therp BV
|
||||
License: GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3 or any later version
|
||||
|
||||
*/
|
||||
|
||||
openerp.web_mode_visibility = function (openerp) {
|
||||
openerp.web.form.Widget.include({
|
||||
init: function(view, node) {
|
||||
this._super(view, node);
|
||||
if (! this.invisible) {
|
||||
if (this.view.form_template == "PageView") {
|
||||
this.invisible = (this.node.attrs.context &&
|
||||
this.node.attrs.context.page_invisible);
|
||||
}
|
||||
else if (this.view.form_template == "FormView") {
|
||||
this.invisible = (this.node.attrs.context &&
|
||||
this.node.attrs.context.form_invisible);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user