def open_remote(self, model, create=True, changed=False, text=None): modelfield = model.mgroup.mfields[self.field_name] relation = modelfield.attrs['relation'] domain=modelfield.domain_get(model) context=modelfield.context_get(model) if create: id = None elif not changed: id = modelfield.get(model) else: rpc = RPCProxy(relation) names = rpc.name_search(text, domain, 'ilike', context) if len(names) == 1: return True, names[0] searched = self.search_remote(relation, [x[0] for x in names], domain=domain, context=context) if searched[0]: return True, searched return False, False dia = M2ODialog(relation, id, domain=domain, context=context, window=self.window) ok, value = dia.run() dia.destroy() if ok: return True, value else: return False, False
def open_remote(self, model, create=True, changed=False, text=None): modelfield = model.mgroup.mfields[self.field_name] relation = modelfield.attrs['relation'] domain = modelfield.domain_get(model) context = modelfield.context_get(model) if create: id = None elif not changed: id = modelfield.get(model) else: rpc = RPCProxy(relation) names = rpc.name_search(text, domain, 'ilike', context) if len(names) == 1: return True, names[0] searched = self.search_remote(relation, [x[0] for x in names], domain=domain, context=context) if searched[0]: return True, searched return False, False dia = M2ODialog(relation, id, domain=domain, context=context, window=self.window) ok, value = dia.run() dia.destroy() if ok: return True, value else: return False, False
def value_from_text(self, model, text): if not text: return [] if not (text[0]<>'('): return model[self.field_name].get(model) relation = model[self.field_name].attrs['relation'] rpc = RPCProxy(relation) domain = model[self.field_name].domain_get(model) context = model[self.field_name].context_get(model) names = rpc.name_search(text, domain, 'ilike', context) ids = [x[0] for x in names] win = win_search(relation, sel_multi=True, ids=ids, context=context, domain=domain) found = win.go() return found or []
def value_from_text(self, model, text): if not text: return False relation = model[self.field_name].attrs["relation"] rpc = RPCProxy(relation) domain = model[self.field_name].domain_get(model) context = model[self.field_name].context_get(model) names = rpc.name_search(text, domain, "ilike", context) if len(names) != 1: return self.search_remote(relation, [x[0] for x in names], domain=domain, context=context)[0] return names[0]
def value_from_text(self, model, text): if not text: return False relation = model[self.field_name].attrs['relation'] rpc = RPCProxy(relation) domain = model[self.field_name].domain_get(model) context = model[self.field_name].context_get(model) names = rpc.name_search(text, domain, 'ilike', context) if len(names) != 1: return self.search_remote(relation, [x[0] for x in names], domain=domain, context=context)[0] return names[0]