Domain in selection must be PYSON decoded
(transplanted from 9c544ce5e67e28ff9571b985b289ef01c5b80af0)
This commit is contained in:
1 parent
978153ddf0
commit
d30bb552b4
2 files changed
+14
-6
No files matched your search
@@ -677,9 +677,13 @@ class Selection(Char):
|
||||
selection_data = gtk.ListStore(str, str)
|
||||
selection = self.attrs.get('selection', [])[:]
|
||||
self.selection = selection[:]
|
||||
if not self.attrs.get('domain'):
|
||||
domain = []
|
||||
else:
|
||||
domain = PYSONDecoder(rpc.CONTEXT).decode(self.attrs['domain'])
|
||||
if 'relation' in self.attrs:
|
||||
args = ('model', self.attrs['relation'], 'search_read',
|
||||
self.attrs.get('domain', []), 0, None, None, rpc.CONTEXT,
|
||||
domain, 0, None, None, rpc.CONTEXT,
|
||||
['rec_name'])
|
||||
try:
|
||||
result = rpc.execute(*args)
|
||||
@@ -699,7 +703,7 @@ class Selection(Char):
|
||||
selection = []
|
||||
self.selection = selection[:]
|
||||
|
||||
for dom in common.filter_domain(self.attrs.get('domain', [])):
|
||||
for dom in common.filter_domain(domain):
|
||||
if dom[1] in ('=', '!='):
|
||||
todel = []
|
||||
for i in xrange(len(selection)):
|
||||
|
||||
@@ -6,6 +6,7 @@ import tryton.rpc as rpc
|
||||
import tryton.common as common
|
||||
import gobject
|
||||
import gettext
|
||||
from tryton.pyson import PYSONDecoder
|
||||
|
||||
_ = gettext.gettext
|
||||
|
||||
@@ -37,11 +38,14 @@ class Selection(Interface):
|
||||
self._selection = {}
|
||||
selection = self.attrs.get('selection', [])
|
||||
if 'relation' in self.attrs:
|
||||
if not self.attrs.get('domain'):
|
||||
domain = []
|
||||
else:
|
||||
domain = PYSONDecoder(rpc.CONTEXT).decode(self.attrs['domain'])
|
||||
try:
|
||||
result = rpc.execute('model',
|
||||
self.attrs['relation'], 'search_read',
|
||||
self.attrs.get('domain', []),
|
||||
0, None, None, rpc.CONTEXT, ['rec_name'])
|
||||
result = rpc.execute('model', self.attrs['relation'],
|
||||
'search_read', domain 0, None, None,
|
||||
rpc.CONTEXT, ['rec_name'])
|
||||
selection = [(x['id'], x['rec_name']) for x in result]
|
||||
except Exception, exception:
|
||||
common.process_exception(exception, parent)
|
||||
|
||||
Reference in new issue
Block a user