Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add 10 support #17

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/components/odoo/jsonRpc-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ angular.module('odoo').provider('jsonRpc', function jsonRpcProvider() {
this.odooRpc = {
odoo_server: "",
uniq_id_counter: 0,
odooVersion: '',
context: {'lang': 'fr_FR'},
shouldManageSessionId: false, //try without first
shouldManageSessionId: false, //try without first for v7
errorInterceptors: []
};

Expand Down Expand Up @@ -97,7 +98,9 @@ angular.module('odoo').provider('jsonRpc', function jsonRpcProvider() {
};

odooRpc.getDbList = function() {
return odooRpc.sendRequest('/web/database/get_list', {});
if (odooRpc.odooVersion[0] == "7" || odooRpc.odooVersion[0] == "8")
return odooRpc.sendRequest('/web/database/get_list', {});
return odooRpc.callJson('db', 'list', {});
};
odooRpc.syncDataImport = function(model, func_key, base_domain, filter_domain, limit, object) {
return odooRpc.call(model, 'get_sync_data', [
Expand Down Expand Up @@ -216,6 +219,14 @@ angular.module('odoo').provider('jsonRpc', function jsonRpcProvider() {
return odooRpc.sendRequest('/web/dataset/call_kw', params);
};

odooRpc.callJson = function(service, method, args) {
var params = {
service: service,
method: method,
args: args,
};
return odooRpc.sendRequest('/jsonrpc', params);
}

/**
* base function
Expand Down Expand Up @@ -340,7 +351,8 @@ angular.module('odoo').provider('jsonRpc', function jsonRpcProvider() {
function preflight() {
//preflightPromise is a kind of cache and is set only if the request succeed
return preflightPromise || http('/web/webclient/version_info', {}).then(function (reason) {
odooRpc.shouldManageSessionId = (reason.result.server_serie < "8"); //server_serie is string like "7.01"
odooRpc.odooVersion = reason.result.server_serie;
odooRpc.shouldManageSessionId = (odooRpc.odooVersion[0] == "7"); //server_serie is string like "7.01"
preflightPromise = $q.when(); //runonce
});
}
Expand Down