Set context as last param of RPC call for new protocol syntax

This commit is contained in:
Cédric Krier committed 2010-08-19 22:27:40 +02:00
1 parent eff0e4be5b
commit d883d99440
12 files changed
+25 -19

No files matched your search

+1 -1
View File
@@ -88,7 +88,7 @@ class Action(object):
action_type = res['type']
try:
res = rpc.execute('model', action_type, 'search_read',
[('action', '=', act_id)], 0, 1, None, ctx, None)
[('action', '=', act_id)], 0, 1, None, None, ctx)
except Exception, exception:
common.process_exception(exception, window)
return
+4 -2
View File
@@ -1078,12 +1078,14 @@ class Main(object):
if not rpc._USER:
return
if not exception:
res = rpc.execute('model', 'res.request', 'request_get')
res = rpc.execute('model', 'res.request', 'request_get',
rpc.CONTEXT)
if not res:
return ([], [])
ids, ids2 = res
else:
ids, ids2 = rpc.execute('model', 'res.request', 'request_get')
ids, ids2 = rpc.execute('model', 'res.request', 'request_get',
rpc.CONTEXT)
label = _('Requests (%s/%s)') % (len(ids), len(ids2))
self.buttons['but_request'].set_label(label)
self.tooltips.set_tip(self.buttons['but_request'], label)
+1 -1
View File
@@ -459,7 +459,7 @@ class Record(SignalEvent):
if self.attachment_count < 0 or reload:
args = ('model', 'ir.attachment', 'search_count', [
('resource', '=', '%s,%s' % (self.model_name, self.id)),
])
], rpc.CONTEXT)
try:
self.attachment_count = rpc.execute(*args)
except Exception:
+3 -2
View File
@@ -292,8 +292,9 @@ class Screen(SignalEvent):
ctx.update(rpc.CONTEXT)
ctx.update(self.context)
args = ('model', self.model_name, 'fields_view_get',
view_id, view_type, ctx,
self.parent and False or CONFIG['form.toolbar'])
view_id, view_type,
self.parent and False or CONFIG['form.toolbar'],
ctx)
try:
view = rpc.execute(*args)
except Exception, exception:
@@ -74,8 +74,8 @@ class Many2One(WidgetInterface):
if attrs.get('completion', False):
try:
result = rpc.execute('model', self.attrs['relation'],
'search_read', [], 0, None, None, rpc.CONTEXT,
['rec_name'])
'search_read', [], 0, None, None, ['rec_name'],
rpc.CONTEXT)
names = [(x['id'], x['rec_name']) for x in result]
except Exception, exception:
common.process_exception(exception, self.window)
@@ -646,7 +646,8 @@ class ParserForm(ParserInterface):
obj_id = self.screen.current_record.save(force_reload=False)
try:
lang_ids = rpc.execute('model', 'ir.lang',
'search', [('translatable', '=', '1')])
'search', [('translatable', '=', '1')],
rpc.CONTEXT)
except Exception, exception:
common.process_exception(exception, self.window)
return False
@@ -657,9 +658,11 @@ class ParserForm(ParserInterface):
return False
try:
lang_ids += rpc.execute('model', 'ir.lang',
'search', [('code', '=', 'en_US')])
'search', [('code', '=', 'en_US')],
rpc.CONTEXT)
langs = rpc.execute('model', 'ir.lang',
'read', lang_ids, ['code', 'name'])
'read', lang_ids, ['code', 'name'],
rpc.CONTEXT)
except Exception, exception:
common.process_exception(exception, self.window)
return False
@@ -41,7 +41,7 @@ class Selection(WidgetInterface):
if 'relation' in attrs:
try:
result = rpc.execute('model', attrs['relation'], 'search_read',
domain, 0, None, None, rpc.CONTEXT, ['rec_name'])
domain, 0, None, None, ['rec_name'], rpc.CONTEXT)
selection = [(x['id'], x['rec_name']) for x in result]
except Exception, exception:
common.process_exception(exception, self.window)
@@ -678,8 +678,8 @@ class Selection(Char):
self.selection = selection[:]
if 'relation' in self.attrs:
args = ('model', self.attrs['relation'], 'search_read',
self.attrs.get('domain', []), 0, None, None, rpc.CONTEXT,
['rec_name'])
self.attrs.get('domain', []), 0, None, None, ['rec_name'],
rpc.CONTEXT)
try:
result = rpc.execute(*args)
except Exception, exception:
@@ -42,7 +42,7 @@ class Reference(Interface):
result = rpc.execute('model',
self.attrs['relation'], 'search_read',
self.attrs.get('domain', []),
0, None, None, rpc.CONTEXT, ['rec_name'])
0, None, None, ['rec_name'], rpc.CONTEXT)
selection = [(x['id'], x['rec_name']) for x in result]
except Exception, exception:
common.process_exception(exception, parent)
@@ -41,7 +41,7 @@ class Selection(Interface):
result = rpc.execute('model',
self.attrs['relation'], 'search_read',
self.attrs.get('domain', []),
0, None, None, rpc.CONTEXT, ['rec_name'])
0, None, None, ['rec_name'], rpc.CONTEXT)
selection = [(x['id'], x['rec_name']) for x in result]
except Exception, exception:
common.process_exception(exception, parent)
+1 -1
View File
@@ -103,7 +103,7 @@ class ViewTreeModel(gtk.GenericTreeModel, gtk.TreeSortable):
'search_read',
self.fields_type[field].get('domain', []),
0, None, None,
rpc.CONTEXT, ['rec_name'])
['rec_name'], rpc.CONTEXT)
selection = [(x['id'], x['rec_name']) for x in result]
except Exception:
selection = []
+2 -2
View File
@@ -167,7 +167,7 @@ class Wizard(object):
from tryton.action import Action
if not 'form' in datas:
datas['form'] = {}
args = ('wizard', action, 'create')
args = ('wizard', action, 'create', rpc.CONTEXT)
try:
wiz_id = rpc.execute(*args)
except Exception, exception:
@@ -246,7 +246,7 @@ class Wizard(object):
dia.destroy()
dia = None
try:
rpc.execute('wizard', action, 'delete', wiz_id)
rpc.execute('wizard', action, 'delete', wiz_id, rpc.CONTEXT)
#XXX to remove when company displayed in status bar
rpc.context_reload()
except Exception: