i'm building an API with Odoo xmlrpc with NodeJs and i made a function to check if the login already exists in the database but it always returns undefined ?? please help
The code :
function user_exist(email){
odoo.connect(function (err) {
if (err) { return console.log(err); }
console.log('Connected to Odoo server.');
var inParams = [];
inParams. push([['active', '=', true]]);
var params = [];
params.push(inParams);
// 4- Read
odoo.execute_kw('res.users', 'search', params , function (err, value) {
if (err) { return console.log(err); }
var inParams = [];
inParams.push(value); //ids
inParams.push(['login']);
var params = [];
params.push(inParams);
odoo.execute_kw('res.users', 'read', params, function (err2, value) {
if (err2) { return console.log(err2); }
for (let i = 0; i < value.length; i++) {
if (email == value[i].login){
return "User exist"
}
}
return "user doesn't exist"
});
});
});
}