From da93d8b440528eb99e6d000c80f318be7c7be88e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Fri, 17 Aug 2012 17:42:48 +0200 Subject: [PATCH] [IMP] point_of_sale: all images are app-cached now bzr revid: fva@openerp.com-20120817154248-z86i0a838wd9ul92 --- addons/point_of_sale/controllers/main.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/controllers/main.py b/addons/point_of_sale/controllers/main.py index d4630768d88..425a7e3d7f8 100644 --- a/addons/point_of_sale/controllers/main.py +++ b/addons/point_of_sale/controllers/main.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- import logging import simplejson +import os +import openerp try: import openerp.addons.web.common.http as openerpweb @@ -29,9 +31,23 @@ class PointOfSaleController(openerpweb.Controller): @openerpweb.httprequest def manifest(self, req, **kwargs): - """ This generates a HTML5 cache manifest files that preloads the categories and products thumbnails """ + """ This generates a HTML5 cache manifest files that preloads the categories and products thumbnails + and other ressources necessary for the point of sale to work offline """ ml = ["CACHE MANIFEST"] + + # loading all the images in the static/src/img/* directories + def load_css_img(srcdir,dstdir): + for f in os.listdir(srcdir): + path = os.path.join(srcdir,f) + dstpath = os.path.join(dstdir,f) + if os.path.isdir(path) : + load_css_img(path,dstpath) + elif f.endswith(('.png','.PNG','.jpg','.JPG','.jpeg','.JPEG','.gif','.GIF')): + ml.append(dstpath) + + imgdir = openerp.modules.get_module_resource('point_of_sale','static/src/img'); + load_css_img(imgdir,'/point_of_sale/static/src/img') products = req.session.model('product.product') for p in products.search_read([('pos_categ_id','!=',False)], ['name']):