From 7bede13b43927c1565184d463a89a17cbc4b9196 Mon Sep 17 00:00:00 2001 From: Arthur Maniet Date: Thu, 30 Apr 2015 12:18:46 +0200 Subject: [PATCH] [ADD] web utils: xor function --- addons/web/static/src/js/framework/utils.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/web/static/src/js/framework/utils.js b/addons/web/static/src/js/framework/utils.js index 5caf995c988..393f3766bed 100644 --- a/addons/web/static/src/js/framework/utils.js +++ b/addons/web/static/src/js/framework/utils.js @@ -332,6 +332,11 @@ function assert (bool) { } } +/* Logical XOR */ +function xor (a, b) { + return (a && !b) || (!a && b); +} + var DropMisordered = Class.extend({ /** * @constructs instance.web.DropMisordered @@ -393,6 +398,7 @@ return { round_decimals: round_decimals, float_is_zero: float_is_zero, assert: assert, + xor: xor, DropMisordered: DropMisordered, };