# -*- coding: utf-8 -*- import logging import simplejson from openerp import http from openerp.http import request from openerp.addons.web.controllers.main import module_boot _logger = logging.getLogger(__name__) html_template = """ Barcode Scanner """ class BarcodeController(http.Controller): @http.route(['/barcode/web/'], type='http', auth='user') def a(self, debug=False, **k): if not request.session.uid: return http.local_redirect('/web/login?redirect=/barcode/web') r = html_template % { 'modules': simplejson.dumps(module_boot(request.db)), 'init': """ var wc = new s.web.WebClient(); wc.show_application = function(){ wc.action_manager.do_action("stock.ui", {}); }; wc.do_push_state = function(state){}; wc.appendTo($(document.body)); """ } return r