Disable main iteration for all RPC request from model/

We can not know if the request is fired during the process of a GTK event.

review686002
This commit is contained in:
Cédric Krier committed 2013-03-04 22:21:52 +01:00
1 parent d670268ff9
commit 76da212d98
2 files changed
+21 -14

No files matched your search

+2 -2
View File
@@ -206,7 +206,7 @@ class Group(SignalEvent, list):
for fnct in self.on_write:
try:
res += RPCExecute('model', self.model_name, fnct, ids,
context=self.context)
main_iteration=False, context=self.context)
except RPCException:
return []
return list({}.fromkeys(res))
@@ -395,7 +395,7 @@ class Group(SignalEvent, list):
if len(new) and len(to_add):
try:
values = RPCExecute('model', self.model_name, 'default_get',
to_add.keys(), context=self.context)
to_add.keys(), main_iteration=False, context=self.context)
except RPCException:
return False
for name in to_add:
+19 -12
View File
@@ -257,7 +257,7 @@ class Record(SignalEvent):
values = self.get()
try:
RPCExecute('model', self.model_name, 'pre_validate', values,
context=self.context_get())
main_iteration=False, context=self.context_get())
except RPCException:
return False
return True
@@ -268,7 +268,8 @@ class Record(SignalEvent):
value = self.get()
try:
res, = RPCExecute('model', self.model_name, 'create',
[value], context=self.context_get())
[value], main_iteration=False,
context=self.context_get())
except RPCException:
return False
old_id = self.id
@@ -282,7 +283,8 @@ class Record(SignalEvent):
context['_timestamp'] = self.get_timestamp()
try:
RPCExecute('model', self.model_name, 'write',
[self.id], value, context=context)
[self.id], value, main_iteration=False,
context=context)
except RPCException:
return False
self._loaded.clear()
@@ -316,7 +318,7 @@ class Record(SignalEvent):
reload_ids = list(reload_ids)
try:
RPCExecute('model', record.model_name, 'delete', list(record_ids),
context=ctx)
main_iteration=False, context=ctx)
except RPCException:
return False
if reload_ids:
@@ -327,7 +329,8 @@ class Record(SignalEvent):
if len(self.group.fields):
try:
vals = RPCExecute('model', self.model_name, 'default_get',
self.group.fields.keys(), context=self.context_get())
self.group.fields.keys(), main_iteration=False,
context=self.context_get())
except RPCException:
return
if (self.parent
@@ -348,7 +351,8 @@ class Record(SignalEvent):
def rec_name(self):
try:
return RPCExecute('model', self.model_name, 'read', [self.id],
['rec_name'], context=self.context_get())[0]['rec_name']
['rec_name'], main_iteration=False,
context=self.context_get())[0]['rec_name']
except RPCException:
return ''
@@ -495,8 +499,9 @@ class Record(SignalEvent):
attr = PYSONDecoder().decode(attr)
args = self._get_on_change_args(attr)
try:
res = RPCExecute('model', self.model_name,
'on_change_' + fieldname, args, context=self.context_get())
res = RPCExecute('model', self.model_name, 'on_change_' +
fieldname, args, main_iteration=False,
context=self.context_get())
except RPCException:
return
self.set_on_change(res)
@@ -527,7 +532,8 @@ class Record(SignalEvent):
if fieldnames:
try:
result = RPCExecute('model', self.model_name, 'on_change_with',
values, list(fieldnames), context=self.context_get())
values, list(fieldnames), main_iteration=False,
context=self.context_get())
except RPCException:
return
self.set_on_change(result)
@@ -538,7 +544,7 @@ class Record(SignalEvent):
try:
result = RPCExecute('model', self.model_name,
'on_change_with_' + fieldname, values,
context=self.context_get())
main_iteration=False, context=self.context_get())
except RPCException:
return
self.group.fields[fieldname].set_on_change(self, result)
@@ -556,7 +562,8 @@ class Record(SignalEvent):
args = self._get_on_change_args(autocomplete)
try:
res = RPCExecute('model', self.model_name, 'autocomplete_' +
fieldname, args, context=self.context_get())
fieldname, args, main_iteration=False,
context=self.context_get())
except RPCException:
# ensure res is a list
res = []
@@ -571,7 +578,7 @@ class Record(SignalEvent):
'search_count', [
('resource', '=',
'%s,%s' % (self.model_name, self.id)),
])
], main_iteration=False)
except RPCException:
return 0
return self.attachment_count