Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenERP Create Method returns Access Denied error

Tags:

php

openerp

Hello I am new in OpenERP and when I am trying to insert a record in Open ERP using Create Method in PHP it returns error Access denied. Following is my Code for Insert:

<?php

include('xmlrpc.inc');

$arrayVal = array(
'name'=>new xmlrpcval('Fabien Pinckaers', "string") ,
'vat'=>new xmlrpcval('BE477472701' , "string")
);

$client = new xmlrpc_client("http://107.23.27.60:8069/xmlrpc/object");

$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval("test_sys", "string"));
$msg->addParam(new xmlrpcval("1", "int"));
$msg->addParam(new xmlrpcval("demo", "string"));
$msg->addParam(new xmlrpcval("res.partner", "string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($arrayVal, "struct"));

$resp = $client->send($msg);

if ($resp->faultCode())

echo 'Error: '.$resp->faultString();

else

echo 'Partner '.$resp->value()->scalarval().' created !';

?>

in above code test_sys is database name and 1 is my user id. Following is the Output:

xmlrpcresp Object
(
[val] => 0
[valtyp] => 
[errno] => -1
[errstr] => Access denied.
[payload] => 
[hdrs] => Array
    (
        [content-type] => text/xml
        [content-length] => 286
        [server] => Werkzeug/0.8.3 Python/2.7.3
        [date] => Thu, 10 Jan 2013 04:29:55 GMT
    )

[_cookies] => Array
    (
    )

[content_type] => text/xml
[raw_data] => HTTP/1.0 200 OK
Content-Type: text/xml
Content-Length: 286
Server: Werkzeug/0.8.3 Python/2.7.3
Date: Thu, 10 Jan 2013 04:29:55 GMT

faultCode
AccessDenied


faultString
Access denied.

)
like image 440
Kumar Avatar asked Oct 22 '22 20:10

Kumar


1 Answers

Please check for permission for the user which you are using to create res.partner record.

I think you are using demo user and demo user dont have permission to create res.partner record.

If you want to add record with demo user, please add create permission in demo's permissions.

like image 140
Nilesh Avatar answered Nov 03 '22 00:11

Nilesh