Created
September 8, 2017 15:33
-
-
Save dperaltab/320d9d6af4f710e2b5ef4ff20eb578f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
odoo.define('minsa_serums.HiddenImport', function (require) { | |
"use strict"; | |
var core = require('web.core'); | |
var Model = require('web.Model'); | |
var Menu = require('web.Menu'); | |
// Ocultar menu Registrar reinscripción para los postulantes | |
Menu.include({ | |
bind_menu: function () { | |
this._super.apply(this, arguments); | |
var self = this | |
var IMD = new Model('ir.model.data'); | |
IMD.call('get_object_reference', ['minsa_serums', 'menu_reg_reinscripcion']).then(function(r) { | |
// Id del menu que deseemos ocultar | |
var xml_menu_id = r[1]; | |
// Verifica que la convocatoria este activo con tipo ordinario y que su modalidad sea remunerado para remover el menu | |
var Convocatoria = new Model('convocatoria'); | |
Convocatoria.call('search', [[["activo", "=", true], '|', ["tipo_convocatoria_id", "!=", 1], ["modalidad", "!=", "remunerado"]]]) | |
.then(function (res) { | |
if (res.length == 0) { | |
var $item = self.$secondary_menus.find('a[data-menu=' + xml_menu_id + ']'); | |
$item.remove(); | |
} | |
}); | |
}); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment