From 5810ea2a97d63b7302f335cc64a2101d53995297 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 19 May 2017 11:11:42 +0200 Subject: [PATCH] [FIX] P3: random.sample on a recordset In P3, random.sample requires that its parameter be a Sequence or a Set. This blows up _cart_accessories. So opt BaseModel into both ABC, seems to work fine. --- odoo/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/odoo/models.py b/odoo/models.py index e3e90a12975..8adb0d9c7d8 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -22,6 +22,8 @@ """ import datetime + +import collections import dateutil import functools import itertools @@ -4952,7 +4954,9 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): } return result - +collections.Set.register(BaseModel) +# not exactly true as BaseModel doesn't have __reversed__, index or count +collections.Sequence.register(BaseModel) class RecordCache(MutableMapping): """ Implements a proxy dictionary to read/update the cache of a record.