From 0e251dbc8e136a81e7710863ec8be9b96c6cb140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Fri, 21 Mar 2014 14:46:23 +0100 Subject: [PATCH] [IMP] posbox: add a homepage to the root controller on the posbox that explains what it is and where to find information bzr revid: fva@openerp.com-20140321134623-eaj56nrh8hkagvym --- addons/hw_posbox_homepage/__init__.py | 25 ++++++++ addons/hw_posbox_homepage/__openerp__.py | 47 ++++++++++++++ .../controllers/__init__.py | 3 + addons/hw_posbox_homepage/controllers/main.py | 63 +++++++++++++++++++ 4 files changed, 138 insertions(+) create mode 100644 addons/hw_posbox_homepage/__init__.py create mode 100644 addons/hw_posbox_homepage/__openerp__.py create mode 100644 addons/hw_posbox_homepage/controllers/__init__.py create mode 100644 addons/hw_posbox_homepage/controllers/main.py diff --git a/addons/hw_posbox_homepage/__init__.py b/addons/hw_posbox_homepage/__init__.py new file mode 100644 index 00000000000..a208bc1c551 --- /dev/null +++ b/addons/hw_posbox_homepage/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import controllers + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/hw_posbox_homepage/__openerp__.py b/addons/hw_posbox_homepage/__openerp__.py new file mode 100644 index 00000000000..7c0cac0f370 --- /dev/null +++ b/addons/hw_posbox_homepage/__openerp__.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'PosBox Homepage', + 'version': '1.0', + 'category': 'Hardware Drivers', + 'sequence': 6, + 'summary': 'A homepage for the PosBox', + 'description': """ +PosBox Homepage +=============== + +This module overrides openerp web interface to display a simple +Homepage that explains what's the posbox and show the status, +and where to find documentation. + +If you activate this module, you won't be able to access the +regular openerp interface anymore. + +""", + 'author': 'OpenERP SA', + 'depends': ['hw_proxy'], + 'installable': False, + 'auto_install': False, +} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hw_posbox_homepage/controllers/__init__.py b/addons/hw_posbox_homepage/controllers/__init__.py new file mode 100644 index 00000000000..b5f0bcc9ec6 --- /dev/null +++ b/addons/hw_posbox_homepage/controllers/__init__.py @@ -0,0 +1,3 @@ +import main +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/hw_posbox_homepage/controllers/main.py b/addons/hw_posbox_homepage/controllers/main.py new file mode 100644 index 00000000000..bab94be060c --- /dev/null +++ b/addons/hw_posbox_homepage/controllers/main.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +import logging +import os +import time +from os import listdir + +import openerp +from openerp import http +from openerp.http import request +from openerp.tools.translate import _ + +_logger = logging.getLogger(__name__) + +index_template = """ + + + + OpenERP's PosBox + + + +

Your PosBox is up and running

+

+ The PosBox is an hardware adapter that allows you to use + receipt printers and barcode scanners with OpenERP's Point of + Sale, version 8.0 or later. You can start an online free trial, + or download and install it yourself. +

+

+ For more information on how to setup the Point of Sale with + the PosBox, please refer to the manual +

+

+ To see the status of the connected hardware, please refer + to the hardware status page +

+

+ The PosBox software installed on this posbox is version 6, + the posbox version number is independent from OpenERP. You can upgrade + the software on the upgrade page +

+

For any other question, please contact the OpenERP support at support@openerp.com +

+ + + +""" + + +class PosboxHomepage(openerp.addons.web.controllers.main.Home): + @http.route('/', type='http', auth='none', website=True) + def index(self): + #return request.render('hw_posbox_homepage.index',mimetype='text/html') + return index_template +