Beispiel #1
0
    def open_remote(self, model, create=True, changed=False, text=None):
        modelfield = model[self.field_name]
        relation = modelfield.attrs['relation']

        rpc = RPCProxy(relation)
        context = model[self.field_name].context_get(model)
        domain = model[self.field_name].domain_get(model)
        if create:
            if text and len(text) and text[0] <> '(':
                domain.append(('name', '=', text))
            ids = rpc.search(domain)
            if ids and len(ids) == 1:
                return True, ids
        else:
            ids = model[self.field_name].get_client(model)
        win = win_search(relation,
                         sel_multi=True,
                         ids=ids,
                         context=context,
                         domain=domain)
        found = win.go()
        if found:
            return True, found
        else:
            return False, None
Beispiel #2
0
    def open_remote(self, model, create=True, changed=False, text=None):
        modelfield = model[self.field_name]
        relation = modelfield.attrs['relation']

        rpc = RPCProxy(relation)
        context = model[self.field_name].context_get(model)
        domain = model[self.field_name].domain_get(model)
        if create:
            if text and len(text) and text[0]<>'(':
                domain.append(('name','=',text))
            ids = rpc.search(domain)
            if ids and len(ids)==1:
                return True, ids
        else:
            ids = model[self.field_name].get_client(model)
        win = win_search(relation, sel_multi=True, ids=ids, context=context, domain=domain)
        found = win.go()
        if found:
            return True, found
        else:
            return False, None
Beispiel #3
0
 def testSearch( self ):
     result = rpc.search( self.store, "sql" )
     self.failUnless( len( result ) > 0 )