sauljabin / xmlrpcwsc-dotnet

XML-RPC Web Service Client C# implementation
GNU Lesser General Public License v3.0
34 stars 21 forks source link

How to execute custom model and custom function? #5

Closed akira32chen closed 2 years ago

akira32chen commented 5 years ago

How to execute custom model and custom function? like the python as below:

models.execute_kw(db, uid, password,
    'res.partner', 'check_access_rights',
    ['read'], {'raise_exception': False})
fjarboleda-lm commented 3 years ago

Here you are...

` XmlRpcClient client = new XmlRpcClient(); client.Url = Url; client.Path = "object";

        var array_read = XmlRpcParameter.AsArray("read");   // ['read']
        var raise_param = XmlRpcParameter.AsStruct(         // {'raise_exception': False}
                            XmlRpcParameter.AsMember("raise_exception", false));

        XmlRpcRequest request = new XmlRpcRequest("execute_kw");
        request.AddParams(db, uid, pasword, "res.partner", "check_access_rights",
                                                        array_read, raise_param );

        XmlRpcResponse response = client.Execute(request);

        if (response.IsFault())
        { ...

`

sauljabin commented 2 years ago

thanks @fjarboleda-lm