diff --git a/tryton/gui/window/view_form/view/list_gtk/parser.py b/tryton/gui/window/view_form/view/list_gtk/parser.py index a8dc824660..481bd6a6aa 100644 --- a/tryton/gui/window/view_form/view/list_gtk/parser.py +++ b/tryton/gui/window/view_form/view/list_gtk/parser.py @@ -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)): diff --git a/tryton/gui/window/view_form/widget_search/selection.py b/tryton/gui/window/view_form/widget_search/selection.py index 4a223e56ab..3737065e8d 100644 --- a/tryton/gui/window/view_form/widget_search/selection.py +++ b/tryton/gui/window/view_form/widget_search/selection.py @@ -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)