From ab3a4692eebfd0970d48ba9fe02c604baf5f604c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 31 Oct 2014 10:54:30 +0100 Subject: [PATCH] Don't compare record values changeset 8e8f1a801098 introduced a equality comparison of records without id using the values. This prevents to store in a dictonary different instances having by chance the same values. So it seems better to consider only as equal the same instances without id. issue4306 review10621002 --- trytond/model/model.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/trytond/model/model.py b/trytond/model/model.py index 606113bb45..5abbaaf9aa 100644 --- a/trytond/model/model.py +++ b/trytond/model/model.py @@ -401,10 +401,8 @@ class Model(WarningErrorMixin, URLMixin, PoolBase): def __eq__(self, other): if not isinstance(other, Model): return NotImplemented - if self.id is None and other.id is None: - return self._values == other._values elif self.id is None or other.id is None: - return False + return id(self) == id(other) return (self.__name__, self.id) == (other.__name__, other.id) def __lt__(self, other):