我正在尝试使用jooRpc使用odoo api从数据库中检索数据,但我得到的错误像“HTTP / 1.1 GET / projects” - 404 Not Found“
这是我的代码snnipet
python脚本,用于操作数据
class projects:
def GET(self):
print("get")
data=[]
web.header('Access-Control-Allow-Origin', '*')
web.header('Access-Control-Allow-Credentials', 'true')
web.header('Content-Type', 'application/json')
auth = web.input()
print(auth)
odoo = odoorpc.ODOO('field.holisticbs.com',port=8069)
odoo.login('field.holisticbs.com','info@holisticbs.com','admin')
Project = odoo.execute('project.task','search_read',[[['company_id', '=', int(auth.company)],['user_id','=',int(auth.user)]]])
return json.dumps(Project)
controller.js
controller('projectCtrl',function ($scope,API,$localStorage,localStorageService) {
// body...
console.log("Project ctrl");
API.showLoad();
var resource = "projects";
API.getData(resource, localStorageService.get('user')).then(function(data) {
// console.log("quotation"+data);
console.log(data);
$scope.projects = data;
}).catch(function(data, status) {
alert("error in request");
//console.error('GET Orders error', response.status, response.data);
}).finally(function() {
console.log("finally finished projects");
API.hideLoad();
});
})
service.js
function getDetails(resource,data) {
console.log(resource);
console.log(data);
var request = $http({
method: "get",
url: backend+resource,
params: {instance: data.inst, user:data.user, company:data.company}
});
return(request.then( handleSuccess, handleError ));
}
project.html(显示空白的查看页面)
<ion-view view-title="Projects">
<ion-content>
<ion-list>
<div class="card" ng-contoller="projectCtrl">
<a class="button button-icon" href="#/app/newProject">
<button class="button button-positive">Create Project</button> </a>
<h2> project </h2>
<ion-item ng-repeat="proj in projects" href="#/app/projects/{{proj.id}}">
<h2 class="padding">{{proj.id}}. {{proj.name}}</h2>
<div class="row" ng-if="proj.partner_id[1]">
<span class="col col-25">Customer:</span>
<span class="col">{{proj.partner_id[1]}}</span>
</div>
<div class="row" ng-if="quot.date_order">
<span class="col col-25">Date:</span>
<span class="col">{{proj.date_order}}</span>
</div>
<div class="row" ng-if="quot.state">
<span class="col col-25">Status:</span>
<span class="col">{{proj.state}}</span>
</div>
</ion-item>
</div>
</ion-list>
</ion-content>
</ion-view>
答案 0 :(得分:0)
urls =( &#39; / products&#39;,&#39;产品&#39;, &#39; / projects&#39;,&#39; projects&#39;, &#39; / product /(.+)',&#39; product&#39; )