From 9d9823ec274fbf97a5c0c4c705ca979020882e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 30 Mar 2015 22:39:26 +0200 Subject: [PATCH] Don't consider as unique clause with nested target issue4552 review14181002 --- tryton/common/domain_inversion.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tryton/common/domain_inversion.py b/tryton/common/domain_inversion.py index 2f426a644f..ae67e5a369 100644 --- a/tryton/common/domain_inversion.py +++ b/tryton/common/domain_inversion.py @@ -209,6 +209,7 @@ def unique_value(domain): "Return if unique, the field and the value" if (isinstance(domain, list) and len(domain) == 1 + and '.' not in domain[0][0] and domain[0][1] == '='): return True, domain[0][1], domain[0][2] else: @@ -507,9 +508,11 @@ def test_unique_value(): domain = [['a', '=', 1]] assert unique_value(domain) == (True, '=', 1) domain = [['a', '!=', 1]] - assert unique_value(domain)[0] == False + assert unique_value(domain)[0] is False domain = [['a', '=', 1], ['a', '=', 2]] - assert unique_value(domain)[0] == False + assert unique_value(domain)[0] is False + domain = [['a.b', '=', 1]] + assert unique_value(domain)[0] is False def test_evaldomain():