angular.module('odoo') /** * ___ __ _ _ _ ___ _ _ _ * / __|___ _ _ / _(_)__ _ _ _ _ _ __ _| |_(_)___ _ _ / __|___ _ _| |_ _ _ ___| | |___ _ _ * | (__/ _ \ ' \| _| / _` | || | '_/ _` | _| / _ \ ' \ | (__/ _ \ ' \ _| '_/ _ \ | / -_) '_| * \___\___/_||_|_| |_\__, |\_,_|_| \__,_|\__|_\___/_||_| \___\___/_||_\__|_| \___/_|_\___|_| * |___/ */ .controller('ConfigurationController', function ( $scope, $state, $ionicLoading, $ionicPopup, $localStorage, odooFactory, deviceFactory, databaseFactory ) { $scope.loading = false; $scope.configuration = $localStorage.$default({ host: '192.168.88.132', port: 8069, database: 'odoo', username: 'admin', password: 'admin', id: null, user_name: null, company_id: null }); /** * */ $scope.auth = function () { $scope.loading = true; odooFactory.auth(function (id) { $scope.configuration.id = id; odooFactory.read('res.users', [['id', '=', id]], function (user) { var data = user[0]; $scope.configuration.user_name = data.name; $scope.configuration.company_id = data.company_id[0]; databaseFactory.initTables(function (result) { $scope.loading = false; $state.go('app.main'); }, function (err) { $scope.loading = false; console.log(err); }); }, function (readErr) { console.log(readErr); $scope.loading = false; deviceFactory.toast('No se ha podido identificar al usuario'); }); }, function (err) { console.log(err); $scope.loading = false; deviceFactory.toast('No se ha podido establecer una conexión al servidor'); }); } });