我想创建订单,并将订单行放到odoo db。但我不能创建一个订单或订单行列表。我得到的错误信息是 faultString: ('The requested operation ("create" on "Sales Order" (sale.order)) was rejected because of the following rules:\\n\\n\\n(Records: SO00078 (id=55), User: yuvaraj (id=14))', None)
.
我使用node js与handlebars和npm包。https:/www.npmjs.compackageodoo-xmlrpc
odoo.connect(function(err){
if(err){
return res.render('placed_order',{error:"oodo connection problem !"})
}
else{
var inParams = [];
inParams.push({
'partner_id': 36,
'company_id':"1",
"date_order":'2020-05-13 07:41:45',
"warehouse_id": "1" ,
'user_id':17,
'state':'sale',
'note':'sale',
"pricelist_id": "1",
"currency_id": 'INR' ,
'expected_date': '2020-05-19 07:41:45',
});
var params = [];
params.push(inParams);
odoo.execute_kw('sale.order','create',params,function(err,order){
if(err){
console.log(err,"No order created")
}
else{
var inParams1 = [];
inParams1.push({
"product_uom":"1",
"product_id": "1",
"product_qty":"1",
"order_id":order,
"price_unit":"2999",
"amount_total":"2999"
})
var params1 = [];
params1.push(inParams1);
console.log(params1,"params1")
odoo.execute_kw('sale.order.line','create',params1,function(error,line){
if(error){
console.log("No order line created",error)
}
res.redirect('thanks?order_id='+order)
})
}
})
}
})
我想是odoo的安全规则给出了这个错误。
因为您没有创建订单的权限。
检查规则的域,并给你的用户(Yuvaraj)正确的权限。