Cache RPC call for class method selection

issue11793
review427971003
This commit is contained in:
Cédric Krier
2022-11-05 09:57:01 +01:00
parent e1dfed65a7
commit 0e7edfbf4c
4 changed files with 8 additions and 3 deletions
+2
View File
@@ -1,3 +1,5 @@
* Cache RPC call for class method selection
Version 6.6.0 - 2022-10-31
--------------------------
* Bug fixes (see mercurial logs for details)
+2 -1
View File
@@ -51,8 +51,9 @@ class MultiSelection(SelectionMixin, Field):
assert hasattr(model, self.selection), \
'Missing %s on model %s' % (self.selection, model.__name__)
instantiate = 0 if self.selection_change_with else None
cache = dict(days=1) if instantiate is None else None
model.__rpc__.setdefault(
self.selection, RPC(instantiate=instantiate))
self.selection, RPC(instantiate=instantiate, cache=cache))
def get(self, ids, model, name, values=None):
lists = {id: () for id in ids}
+2 -1
View File
@@ -110,8 +110,9 @@ class Reference(SelectionMixin, Field):
assert hasattr(model, self.selection), \
'Missing %s on model %s' % (self.selection, model.__name__)
instantiate = 0 if self.selection_change_with else None
cache = dict(days=1) if instantiate is None else None
model.__rpc__.setdefault(
self.selection, RPC(instantiate=instantiate))
self.selection, RPC(instantiate=instantiate, cache=cache))
def get(self, ids, model, name, values=None):
'''
+2 -1
View File
@@ -116,8 +116,9 @@ class Selection(SelectionMixin, Field):
assert hasattr(model, self.selection), \
'Missing %s on model %s' % (self.selection, model.__name__)
instantiate = 0 if self.selection_change_with else None
cache = dict(days=1) if instantiate is None else None
model.__rpc__.setdefault(
self.selection, RPC(instantiate=instantiate))
self.selection, RPC(instantiate=instantiate, cache=cache))
def convert_order(self, name, tables, Model):
if getattr(Model, 'order_%s' % name, None):