Browse Source

[ADD] Module web_mode_visibility

pull/2/head
Stefan Rijnhart 11 years ago
committed by Guewen Baconnier
parent
commit
2b78a881d3
  1. 0
      web_mode_visibility/__init__.py
  2. 44
      web_mode_visibility/__openerp__.py
  3. 26
      web_mode_visibility/static/src/js/web_mode_visibility.js

0
web_mode_visibility/__init__.py

44
web_mode_visibility/__openerp__.py

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name": "Visibility depending on view mode",
"version": "6.1.1.0r1",
"author": "Therp BV",
"category": "Tools",
"depends": ['web'],
"description": """
Use the following boolean switches in the options dictionary on fields to hide
them in either page or form mode:
- page_invisible
- form_invisible
For example:
<field name="partner_id" options='{"page_invisible": true}' />
This module is compatible with OpenERP 6.1.
""",
'js': [
'static/src/js/web_mode_visibility.js',
],
}

26
web_mode_visibility/static/src/js/web_mode_visibility.js

@ -0,0 +1,26 @@
/*
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.Field.include({
init: function(view, node) {
this._super(view, node);
if (! this.invisible) {
var options = this.get_definition_options();
if (this.view.form_template == "PageView") {
this.invisible = options.page_invisible;
}
else if (this.view.form_template == "FormView") {
this.invisible = options.form_invisible;
}
}
},
});
}
Loading…
Cancel
Save