[IMP] point_of_sale add html5 manifest on /pos/app
bzr revid: al@openerp.com-20120813221601-gfvwiwii6s1b785d
This commit is contained in:
parent
48062d4cf1
commit
8627aa0b28
|
@ -83,7 +83,6 @@ Main features:
|
|||
'application': True,
|
||||
# Web client
|
||||
'js': [
|
||||
'static/lib/backbone/backbone-0.9.2.js',
|
||||
'static/lib/mousewheel/jquery.mousewheel-3.0.6.js',
|
||||
'static/src/js/pos_db.js',
|
||||
'static/src/js/pos_models.js',
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
import main
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -1,14 +1,44 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import logging
|
||||
import simplejson
|
||||
|
||||
try:
|
||||
import openerp.addons.web.common.http as openerpweb
|
||||
from openerp.addons.web.controllers.main import manifest_list, module_boot, html_template
|
||||
except ImportError:
|
||||
import web.common.http as openerpweb
|
||||
|
||||
class PointOfSaleController(openerpweb.Controller):
|
||||
_cp_path = '/pos'
|
||||
|
||||
@openerpweb.httprequest
|
||||
def app(self, req, s_action=None, **kw):
|
||||
js = "\n ".join('<script type="text/javascript" src="%s"></script>' % i for i in manifest_list(req, None, 'js'))
|
||||
css = "\n ".join('<link rel="stylesheet" href="%s">' % i for i in manifest_list(req, None, 'css'))
|
||||
|
||||
cookie = req.httprequest.cookies.get("instance0|session_id")
|
||||
session_id = cookie.replace("%22","")
|
||||
template = html_template.replace('<html','<html manifest="/pos/manifest?session_id=%s"'%session_id)
|
||||
r = template % {
|
||||
'js': js,
|
||||
'css': css,
|
||||
'modules': simplejson.dumps(module_boot(req)),
|
||||
'init': 'var wc = new s.web.WebClient();wc.appendTo($(document.body));'
|
||||
}
|
||||
return r
|
||||
|
||||
@openerpweb.httprequest
|
||||
def manifest(self, req, **kwargs):
|
||||
ml = ["CACHE MANIFEST"]
|
||||
Products = req.session.model('product.product')
|
||||
for p in Products.search_read([('pos_categ_id','!=',False)], ['name', 'dependencies_id']):
|
||||
session_id = req.session_id
|
||||
product_id = p['id']
|
||||
url = "/web/binary/image?session_id=%s&model=product.product&field=image&id=%s" % (session_id, product_id)
|
||||
ml.append(url)
|
||||
m = "\n".join(ml)
|
||||
return m
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
def dispatch(self, request, iface, **kwargs):
|
||||
method = 'iface_%s' % iface
|
||||
|
@ -109,3 +139,4 @@ class PointOfSaleController(openerpweb.Controller):
|
|||
print 'print_receipt' + str(receipt)
|
||||
return
|
||||
|
||||
|
Loading…
Reference in New Issue