2012-04-13 04:17:59 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import logging
|
2012-08-13 22:16:01 +00:00
|
|
|
import simplejson
|
2012-08-17 15:42:48 +00:00
|
|
|
import os
|
|
|
|
import openerp
|
2013-09-11 15:41:55 +00:00
|
|
|
import time
|
|
|
|
import random
|
2012-04-23 11:04:03 +00:00
|
|
|
|
2013-10-22 17:06:59 +00:00
|
|
|
from openerp import http
|
|
|
|
from openerp.http import request
|
2014-05-06 16:33:34 +00:00
|
|
|
from openerp.addons.web.controllers.main import module_boot, login_redirect
|
2012-04-13 04:17:59 +00:00
|
|
|
|
2013-09-12 13:50:44 +00:00
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
2013-11-27 14:44:27 +00:00
|
|
|
html_template = """<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2013-11-27 19:17:50 +00:00
|
|
|
<title>OpenERP POS</title>
|
2013-11-27 14:44:27 +00:00
|
|
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
|
|
|
<meta http-equiv="content-type" content="text/html, charset=utf-8" />
|
|
|
|
|
|
|
|
<meta name="viewport" content=" width=1024, user-scalable=no">
|
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
2013-11-27 19:17:50 +00:00
|
|
|
<meta name="mobile-web-app-capable" content="yes">
|
2013-11-27 14:44:27 +00:00
|
|
|
|
2013-11-27 19:17:50 +00:00
|
|
|
<link rel="shortcut icon" sizes="196x196" href="/point_of_sale/static/src/img/touch-icon-196.png">
|
|
|
|
<link rel="shortcut icon" sizes="128x128" href="/point_of_sale/static/src/img/touch-icon-128.png">
|
2013-11-27 14:44:27 +00:00
|
|
|
<link rel="apple-touch-icon" href="/point_of_sale/static/src/img/touch-icon-iphone.png">
|
|
|
|
<link rel="apple-touch-icon" sizes="76x76" href="/point_of_sale/static/src/img/touch-icon-ipad.png">
|
|
|
|
<link rel="apple-touch-icon" sizes="120x120" href="/point_of_sale/static/src/img/touch-icon-iphone-retina.png">
|
|
|
|
<link rel="apple-touch-icon" sizes="152x152" href="/point_of_sale/static/src/img/touch-icon-ipad-retina.png">
|
|
|
|
|
|
|
|
<link rel="shortcut icon" href="/web/static/src/img/favicon.ico" type="image/x-icon"/>
|
2013-12-17 15:15:50 +00:00
|
|
|
<link rel="stylesheet" href="/point_of_sale/static/src/fonts/lato/stylesheet.css" />
|
2014-01-16 11:23:22 +00:00
|
|
|
<link rel="stylesheet" href="/point_of_sale/static/src/fonts/font-awesome-4.0.3/css/font-awesome.min.css" />
|
2013-12-05 17:53:25 +00:00
|
|
|
<link rel="stylesheet" href="/point_of_sale/static/src/css/pos.css" />
|
2013-12-16 18:20:59 +00:00
|
|
|
<link rel="stylesheet" href="/point_of_sale/static/src/css/keyboard.css" />
|
2014-04-30 12:16:32 +00:00
|
|
|
<script type="text/javascript" src="/web/js/web.assets_backend"></script>
|
2013-11-27 14:44:27 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
$(function() {
|
|
|
|
var s = new openerp.init(%(modules)s);
|
|
|
|
%(init)s
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!--[if lte IE 8]>
|
|
|
|
<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
|
|
|
|
<script>CFInstall.check({mode: "overlay"});</script>
|
|
|
|
<![endif]-->
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
"""
|
|
|
|
|
|
|
|
class PosController(http.Controller):
|
|
|
|
|
|
|
|
@http.route('/pos/web', type='http', auth='none')
|
|
|
|
def a(self, debug=False, **k):
|
2013-11-27 19:17:50 +00:00
|
|
|
|
2014-01-31 11:45:42 +00:00
|
|
|
if not request.session.uid:
|
2014-03-10 15:38:38 +00:00
|
|
|
return login_redirect()
|
2013-11-27 19:17:50 +00:00
|
|
|
|
2013-11-27 14:44:27 +00:00
|
|
|
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("pos.ui");
|
|
|
|
};
|
2013-12-02 16:21:44 +00:00
|
|
|
wc.appendTo($(document.body));
|
2013-11-27 14:44:27 +00:00
|
|
|
"""
|
2012-08-13 22:16:01 +00:00
|
|
|
}
|
|
|
|
return r
|