[IMP] web: add archParseBoolean util function
This function must be used to parse boolean attributes from archs. If returns false if the attribute is set to "False", "false", "0" or "", true otherwise. Part-of: odoo/odoo#73311
This commit is contained in:
committed by
Aaron Bohy
parent
1fd54eeae7
commit
57992c51b5
@@ -0,0 +1,13 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
/**
|
||||
* Parse the arch to check if is true or false
|
||||
* If the string is empyt, 0, False or false it's considered as false
|
||||
* The rest is considered as true
|
||||
*
|
||||
* @param {string} str
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function archParseBoolean(str) {
|
||||
return str !== "False" && str !== "false" && str !== "0" && str !== "";
|
||||
}
|
||||
Reference in New Issue
Block a user