openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #07413
[Merge] lp:~openerp-dev/openobject-client/trunk-bug-728275-rga into lp:openobject-client
Ravi Gadhia (OpenERP) has proposed merging lp:~openerp-dev/openobject-client/trunk-bug-728275-rga into lp:openobject-client.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
Related bugs:
Bug #728275 in OpenERP GTK Client: "view/list: Fix handling of duplicate IDs from search()"
https://bugs.launchpad.net/openobject-client/+bug/728275
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-client/trunk-bug-728275-rga/+merge/62287
--
https://code.launchpad.net/~openerp-dev/openobject-client/trunk-bug-728275-rga/+merge/62287
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-client/trunk-bug-728275-rga.
=== modified file 'bin/widget/model/field.py'
--- bin/widget/model/field.py 2011-04-20 09:34:21 +0000
+++ bin/widget/model/field.py 2011-05-25 12:18:38 +0000
@@ -363,6 +363,13 @@
for val in value:
result += rpc2.name_search(val, [], '=', rpc.session.context)
value = map(lambda x:x[0], result)
+
+ if value:
+ uids = []
+ #remove duplicate id
+ map(lambda x: x not in uids and uids.append(x), value)
+ value = uids
+
model.value[self.name] = value and value[:self.limit] or []
model.pager_cache[self.name] = value or []
if modified:
@@ -428,6 +435,13 @@
if value and not isinstance(value[0], int):
model = self.set_default(model, value)
return
+
+ if value:
+ uids = []
+ #remove duplicate id
+ map(lambda x: x not in uids and uids.append(x), value)
+ value = uids
+
from widget.model.group import ModelRecordGroup
mod = ModelRecordGroup(resource=self.attrs['relation'], fields={}, parent=model)
mod.signal_connect(mod, 'model-changed', self._model_changed)
=== modified file 'bin/widget/screen/screen.py'
--- bin/widget/screen/screen.py 2011-05-10 11:13:09 +0000
+++ bin/widget/screen/screen.py 2011-05-25 12:18:38 +0000
@@ -269,14 +269,18 @@
self.display()
return True
ids = rpc.session.rpc_exec_auth('/object', 'execute', self.name, 'search', v, offset, limit, self.sort, self.context)
- self.win_search_ids = ids
+ uids = []
+ #remove duplicate id
+ map(lambda x: x not in uids and uids.append(x), ids)
+
+ self.win_search_ids = uids
if self.win_search and self.win_search_domain:
for dom in self.win_search_domain:
if dom in v:
v.remove(dom)
self.win_search_domain = []
- if len(ids) < limit:
- self.search_count = len(ids)
+ if len(uids) < limit:
+ self.search_count = len(uids)
else:
self.search_count = rpc.session.rpc_exec_auth_try('/object', 'execute', self.name, 'search_count', v, self.context)
self.update_scroll()
@@ -284,7 +288,7 @@
if self.sort_domain in v:
v.remove(self.sort_domain)
self.sort_domain = []
- self.load(ids)
+ self.load(uids)
return True
def execute_action(self, combo):
=== modified file 'bin/widget/view/list.py'
--- bin/widget/view/list.py 2011-05-20 10:05:44 +0000
+++ bin/widget/view/list.py 2011-05-25 12:18:38 +0000
@@ -186,12 +186,15 @@
if self.context.get('__domain') and not no_leaf:
limit = self.screen.screen_container.get_limit()
ids = rpc.session.rpc_exec_auth('/object', 'execute', self.mgroup.resource, 'search', self.context.get('__domain'), 0, limit, self.sort_order, self.context)
- if not ids:
+ uids = []
+ #remove duplicate id
+ map(lambda x: x not in uids and uids.append(x), ids)
+ if not uids:
self.add_dummny_record(self.context['__field'])
else:
- self.mgroup.load(ids)
+ self.mgroup.load(uids)
res= []
- for id in ids:
+ for id in uids:
res.append(self.mgroup.get_by_id(id))
self.add_list(res)
else: