Add removed_ids when searching records to add to one2many

This commit is contained in:
Cédric Krier committed 2008-11-22 01:33:31 +01:00
1 parent 7e9722fc73
commit fdf5c18895
2 files changed
+6 -1

No files matched your search

@@ -509,6 +509,9 @@ class O2MField(CharField):
else:
model.value[self.name].readonly = False
def get_removed_ids(self, model):
return model.value[self.name].model_removed
class ReferenceField(CharField):
@@ -592,10 +592,12 @@ class One2Many(WidgetInterface):
domain = domain[:]
domain.extend(self._view.model.expr_eval(self.attrs.get('add_remove'),
context))
removed_ids = self._view.modelfield.get_removed_ids(self._view.model)
try:
ids = rpc.execute('object', 'execute', self.attrs['relation'],
'name_search', self.wid_text.get_text(), domain, 'ilike',
'name_search', self.wid_text.get_text(),
['OR', domain, ('id', 'in', removed_ids)], 'ilike',
context, _LIMIT)
except Exception, exception:
common.process_exception(exception, self._window)