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
This commit is contained in:
Cédric Krier committed 2014-10-31 10:54:30 +01:00
1 parent fee97ca399
commit ab3a4692ee
1 file changed
+1 -3
+1 -3
View File
@@ -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):