├── .bowerrc ├── .gitignore ├── README.md ├── bower.json ├── config.xml ├── gulpfile.js ├── hooks ├── README.md └── after_prepare │ └── 010_add_platform_class.js ├── package.json ├── scss └── ionic.app.scss └── www ├── README.md ├── css └── style.css ├── data └── production.factory.js ├── detail ├── detail.ctrl.js └── detail.html ├── img └── ionic.png ├── index.html ├── js └── app.js ├── list ├── list.ctrl.js └── list.html └── login ├── login.ctrl.js └── login.html /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "www/lib" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Specifies intentionally untracked files to ignore when using Git 2 | # http://git-scm.com/docs/gitignore 3 | 4 | node_modules/ 5 | platforms/ 6 | plugins/ 7 | www/lib/ 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | See [www/README.md](www/README.md) -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HelloIonic", 3 | "private": "true", 4 | "devDependencies": { 5 | "ionic": "driftyco/ionic-bower#1.0.0" 6 | }, 7 | "dependencies": { 8 | "odoo": "hparfr/angular-odoo#develop" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | HelloCordova 4 | 5 | An Ionic Framework and Cordova project. 6 | 7 | 8 | Ionic Framework Team 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var gutil = require('gulp-util'); 3 | var bower = require('bower'); 4 | var concat = require('gulp-concat'); 5 | var sass = require('gulp-sass'); 6 | var minifyCss = require('gulp-minify-css'); 7 | var rename = require('gulp-rename'); 8 | var sh = require('shelljs'); 9 | 10 | var paths = { 11 | sass: ['./scss/**/*.scss'] 12 | }; 13 | 14 | gulp.task('default', ['sass']); 15 | 16 | gulp.task('sass', function(done) { 17 | gulp.src('./scss/ionic.app.scss') 18 | .pipe(sass({ 19 | errLogToConsole: true 20 | })) 21 | .pipe(gulp.dest('./www/css/')) 22 | .pipe(minifyCss({ 23 | keepSpecialComments: 0 24 | })) 25 | .pipe(rename({ extname: '.min.css' })) 26 | .pipe(gulp.dest('./www/css/')) 27 | .on('end', done); 28 | }); 29 | 30 | gulp.task('watch', function() { 31 | gulp.watch(paths.sass, ['sass']); 32 | }); 33 | 34 | gulp.task('install', ['git-check'], function() { 35 | return bower.commands.install() 36 | .on('log', function(data) { 37 | gutil.log('bower', gutil.colors.cyan(data.id), data.message); 38 | }); 39 | }); 40 | 41 | gulp.task('git-check', function(done) { 42 | if (!sh.which('git')) { 43 | console.log( 44 | ' ' + gutil.colors.red('Git is not installed.'), 45 | '\n Git, the version control system, is required to download Ionic.', 46 | '\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.', 47 | '\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.' 48 | ); 49 | process.exit(1); 50 | } 51 | done(); 52 | }); 53 | -------------------------------------------------------------------------------- /hooks/README.md: -------------------------------------------------------------------------------- 1 | 21 | # Cordova Hooks 22 | 23 | This directory may contain scripts used to customize cordova commands. This 24 | directory used to exist at `.cordova/hooks`, but has now been moved to the 25 | project root. Any scripts you add to these directories will be executed before 26 | and after the commands corresponding to the directory name. Useful for 27 | integrating your own build systems or integrating with version control systems. 28 | 29 | __Remember__: Make your scripts executable. 30 | 31 | ## Hook Directories 32 | The following subdirectories will be used for hooks: 33 | 34 | after_build/ 35 | after_compile/ 36 | after_docs/ 37 | after_emulate/ 38 | after_platform_add/ 39 | after_platform_rm/ 40 | after_platform_ls/ 41 | after_plugin_add/ 42 | after_plugin_ls/ 43 | after_plugin_rm/ 44 | after_plugin_search/ 45 | after_prepare/ 46 | after_run/ 47 | after_serve/ 48 | before_build/ 49 | before_compile/ 50 | before_docs/ 51 | before_emulate/ 52 | before_platform_add/ 53 | before_platform_rm/ 54 | before_platform_ls/ 55 | before_plugin_add/ 56 | before_plugin_ls/ 57 | before_plugin_rm/ 58 | before_plugin_search/ 59 | before_prepare/ 60 | before_run/ 61 | before_serve/ 62 | pre_package/ <-- Windows 8 and Windows Phone only. 63 | 64 | ## Script Interface 65 | 66 | All scripts are run from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables: 67 | 68 | * CORDOVA_VERSION - The version of the Cordova-CLI. 69 | * CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios). 70 | * CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer) 71 | * CORDOVA_HOOK - Path to the hook that is being executed. 72 | * CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate) 73 | 74 | If a script returns a non-zero exit code, then the parent cordova command will be aborted. 75 | 76 | 77 | ## Writing hooks 78 | 79 | We highly recommend writting your hooks using Node.js so that they are 80 | cross-platform. Some good examples are shown here: 81 | 82 | [http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/) 83 | 84 | -------------------------------------------------------------------------------- /hooks/after_prepare/010_add_platform_class.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Add Platform Class 4 | // v1.0 5 | // Automatically adds the platform class to the body tag 6 | // after the `prepare` command. By placing the platform CSS classes 7 | // directly in the HTML built for the platform, it speeds up 8 | // rendering the correct layout/style for the specific platform 9 | // instead of waiting for the JS to figure out the correct classes. 10 | 11 | var fs = require('fs'); 12 | var path = require('path'); 13 | 14 | var rootdir = process.argv[2]; 15 | 16 | function addPlatformBodyTag(indexPath, platform) { 17 | // add the platform class to the body tag 18 | try { 19 | var platformClass = 'platform-' + platform; 20 | var cordovaClass = 'platform-cordova platform-webview'; 21 | 22 | var html = fs.readFileSync(indexPath, 'utf8'); 23 | 24 | var bodyTag = findBodyTag(html); 25 | if(!bodyTag) return; // no opening body tag, something's wrong 26 | 27 | if(bodyTag.indexOf(platformClass) > -1) return; // already added 28 | 29 | var newBodyTag = bodyTag; 30 | 31 | var classAttr = findClassAttr(bodyTag); 32 | if(classAttr) { 33 | // body tag has existing class attribute, add the classname 34 | var endingQuote = classAttr.substring(classAttr.length-1); 35 | var newClassAttr = classAttr.substring(0, classAttr.length-1); 36 | newClassAttr += ' ' + platformClass + ' ' + cordovaClass + endingQuote; 37 | newBodyTag = bodyTag.replace(classAttr, newClassAttr); 38 | 39 | } else { 40 | // add class attribute to the body tag 41 | newBodyTag = bodyTag.replace('>', ' class="' + platformClass + ' ' + cordovaClass + '">'); 42 | } 43 | 44 | html = html.replace(bodyTag, newBodyTag); 45 | 46 | fs.writeFileSync(indexPath, html, 'utf8'); 47 | 48 | process.stdout.write('add to body class: ' + platformClass + '\n'); 49 | } catch(e) { 50 | process.stdout.write(e); 51 | } 52 | } 53 | 54 | function findBodyTag(html) { 55 | // get the body tag 56 | try{ 57 | return html.match(/])(.*?)>/gi)[0]; 58 | }catch(e){} 59 | } 60 | 61 | function findClassAttr(bodyTag) { 62 | // get the body tag's class attribute 63 | try{ 64 | return bodyTag.match(/ class=["|'](.*?)["|']/gi)[0]; 65 | }catch(e){} 66 | } 67 | 68 | if (rootdir) { 69 | 70 | // go through each of the platform directories that have been prepared 71 | var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []); 72 | 73 | for(var x=0; x 2 | 3 | 4 |
5 |
6 |
Products to Consume
7 | 8 |
9 | {{ move.product_qty }} 10 | X 11 | {{ move.product_id.default_code }} 12 |
13 |
14 | 15 |
16 |
Work Order
17 |
18 | {{ line.name }} 19 |
20 |
21 |
22 | 23 |
24 | 25 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /www/img/ionic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hparfr/odoo-ionic-sample/2444fcf04d501a27c1523b68c4ceddd50908a62c/www/img/ionic.png -------------------------------------------------------------------------------- /www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /www/js/app.js: -------------------------------------------------------------------------------- 1 | // Ionic Starter App 2 | 3 | // angular.module is a global place for creating, registering and retrieving Angular modules 4 | // 'starter' is the name of this angular module example (also set in a attribute in index.html) 5 | // the 2nd parameter is an array of 'requires' 6 | angular.module('starter', ['ionic', 'ui.router', 'odoo']) 7 | 8 | .run(function($ionicPlatform) { 9 | $ionicPlatform.ready(function() { 10 | // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard 11 | // for form inputs) 12 | if(window.cordova && window.cordova.plugins.Keyboard) { 13 | cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); 14 | } 15 | if(window.StatusBar) { 16 | StatusBar.styleDefault(); 17 | } 18 | }); 19 | }) 20 | .run(['jsonRpc', '$state', '$rootScope', function (jsonRpc, $state, $rootScope) { 21 | jsonRpc.errorInterceptors.push(function (a) { 22 | $state.go('login'); 23 | console.log('error : ', a); 24 | }); 25 | 26 | }]) 27 | .config(['$stateProvider','$urlRouterProvider' , function ($stateProvider, $urlRouterProvider) { 28 | $stateProvider.state('list', { 29 | url: '/', 30 | templateUrl: 'list/list.html', 31 | controller: 'ListCtrl', 32 | resolve: { 33 | production: 'production' 34 | } 35 | }).state('detail', { 36 | url: '/detail/{id}', 37 | templateUrl: 'detail/detail.html', 38 | controller: 'DetailCtrl', 39 | resolve: { 40 | production: 'production' 41 | } 42 | }).state('login', { 43 | url: '/login', 44 | templateUrl: 'login/login.html', 45 | controller: 'LoginCtrl' 46 | }); 47 | $urlRouterProvider.otherwise('/'); 48 | }]); 49 | -------------------------------------------------------------------------------- /www/list/list.ctrl.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | 4 | angular.module('starter').controller('ListCtrl', ['$scope', 'production', function ($scope, production) { 5 | $scope.mrpProduction = production.data; 6 | }]); 7 | -------------------------------------------------------------------------------- /www/list/list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ item.name }} 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /www/login/login.ctrl.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | 4 | angular.module('starter').controller('LoginCtrl', ['$scope', 'jsonRpc', '$state', function ($scope, jsonRpc, $state) { 5 | 6 | $scope.login = { 7 | 'db': 'db', 8 | 'username':'admin', 9 | 'server': '' 10 | }; 11 | $scope.submit = function () { 12 | console.log('send', $scope.login); 13 | jsonRpc.odoo_server = $scope.login.server; 14 | jsonRpc.login($scope.login.db, $scope.login.username, $scope.login.password).then(function (a) { 15 | $state.go('list'); 16 | }, function(e) { 17 | $scope.errorMessage = e.message; 18 | }); 19 | } 20 | }]); -------------------------------------------------------------------------------- /www/login/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
{{ errorMessage }}
4 |
5 |
6 | 7 | 8 | 9 | 10 |
11 |
12 | 13 | 14 | --------------------------------------------------------------------------------