Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD][14.0] pos_kiosk: self-service kiosks #1043

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions pos_kiosk/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
==========================
Point of Sale - Kiosk Mode
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2990d060797f495b7bd63bf4a1782c2b706f93a9e9ee93b0b31454959bff03d4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github
:target: https://github.com/OCA/pos/tree/14.0/pos_kiosk
:alt: OCA/pos
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pos-14-0/pos-14-0-pos_kiosk
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/pos&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

[ This file must be max 2-3 paragraphs, and is required. ]

This module extends the functionality of ... to support ...
and to allow you to ...

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Configuration
=============

[ This file is optional, it should explain how to configure
the module before using it; it is aimed at advanced users. ]

To configure this module, you need to:

#. Go to ...

.. figure:: https://raw.githubusercontent.com/OCA/pos/14.0/pos_kiosk/static/description/image.png
:alt: alternative description
:width: 600 px

Usage
=====

[ This file must be present and contains the usage instructions
for end-users. As all other rst files included in the README,
it MUST NOT contain reStructuredText sections
only body text (paragraphs, lists, tables, etc). Should you need
a more elaborate structure to explain the addon, please create a
Sphinx documentation (which may include this file as a "quick start"
section). ]

To use this module, you need to:

#. Go to ...

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/pos/issues/new?body=module:%20pos_kiosk%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* KMEE

Contributors
~~~~~~~~~~~~

* Ygor Carvalho <ygor.carvalho@kmee.com.br>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/14.0/pos_kiosk>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions pos_kiosk/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
33 changes: 33 additions & 0 deletions pos_kiosk/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "Point of Sale - Kiosk Mode",
"version": "14.0.1.0.0",
"category": "Sales/Point of Sale",
"summary": "Kiosk mode extension for the Point of Sale ",
"author": "KMEE, Odoo Community Association (OCA)",
"depends": ["point_of_sale"],
"development_status": "Alpha",
"website": "https://github.com/OCA/pos",
"data": [
"views/pos_config_view.xml",
"views/pos_assets_kiosk_common.xml",
"views/pos_assets_kiosk_index.xml",
],
"qweb": [
"static/src/xml/ChromeKiosk.xml",
"static/src/xml/Components/KioskHeader.xml",
"static/src/xml/Components/KioskCartFooter.xml",
"static/src/xml/Screens/WelcomeScreen.xml",
"static/src/xml/Screens/ProductScreen/KioskProductScreen.xml",
"static/src/xml/Screens/ProductScreen/KioskProductCategory.xml",
"static/src/xml/Screens/KioskPaymentScreen.xml",
"static/src/xml/Modals/InsertProductModal.xml",
"static/src/xml/Modals/InsertProductConfigurableModal.xml",
"static/src/xml/Modals/CartModal.xml",
"static/src/xml/Screens/KioskReceiptScreen.xml",
"static/src/xml/Screens/KioskClientScreen.xml",
"static/src/xml/Modals/ErrorModal.xml",
],
"installable": True,
"auto_install": False,
"license": "LGPL-3",
}
1 change: 1 addition & 0 deletions pos_kiosk/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
48 changes: 48 additions & 0 deletions pos_kiosk/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import werkzeug.utils

from odoo import http
from odoo.http import request
from odoo.osv.expression import AND


class PosKioskController(http.Controller):
@http.route(["/pos_kiosk/web", "/pos_kiosk/ui"], type="http", auth="user")
def pos_kiosk_web(self, config_id=False, **k):
domain = [
("state", "in", ["opening_control", "opened"]),
("user_id", "=", request.session.uid),
("rescue", "=", False),
]

if config_id:
domain = AND([domain, [("config_id", "=", config_id)]])
pos_session = request.env["pos.session"].sudo().search(domain, limit=1)

if not pos_session and config_id:
domain = [
("state", "in", ["opening_control", "opened"]),
("rescue", "=", False),
("config_id", "=", int(config_id)),
]
pos_session = request.env["pos.session"].sudo().search(domain, limit=1)

if not pos_session:
return werkzeug.utils.redirect(
"/web#action=point_of_sale.action_client_pos_menu"
)

company = pos_session.company_id
session_info = request.env["ir.http"].session_info()
session_info["user_context"]["allowed_company_ids"] = company.ids
session_info["user_companies"] = {
"current_company": (company.id, company.name),
"allowed_companies": [(company.id, company.name)],
}
context = {
"session_info": session_info,
"login_number": pos_session.login(),
}

response = request.render("pos_kiosk.index", context)
response.headers["Cache-Control"] = "no-store"
return response
1 change: 1 addition & 0 deletions pos_kiosk/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import pos_config
30 changes: 30 additions & 0 deletions pos_kiosk/models/pos_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from odoo import fields, models


class PosConfig(models.Model):
_inherit = "pos.config"

is_kiosk_mode = fields.Boolean(
string="Kiosk Mode",
help="If checked, the POS will be opened in kiosk mode.",
)

banner_image = fields.Binary(
string="Banner Image",
help="This field holds the image used as banner on the POS screen Kiosk Mode.",
)

top_banner_image = fields.Binary(
string="Top Banner Image",
help="This field holds the image used as top banner on the POS screen Kiosk Mode.",
)

logo_image = fields.Binary(
string="Logo Image",
help="This field holds the image used as logo on the POS header in Kiosk Mode.",
)

def _get_pos_base_url(self):
if self.is_kiosk_mode:
return "/pos_kiosk/web" if self._force_http() else "/pos_kiosk/ui"
return super(PosConfig, self)._get_pos_base_url()
10 changes: 10 additions & 0 deletions pos_kiosk/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[ This file is optional, it should explain how to configure
the module before using it; it is aimed at advanced users. ]

To configure this module, you need to:

#. Go to ...

.. figure:: ../static/description/image.png
:alt: alternative description
:width: 600 px
1 change: 1 addition & 0 deletions pos_kiosk/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Ygor Carvalho <ygor.carvalho@kmee.com.br>
4 changes: 4 additions & 0 deletions pos_kiosk/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[ This file must be max 2-3 paragraphs, and is required. ]

This module extends the functionality of ... to support ...
and to allow you to ...
11 changes: 11 additions & 0 deletions pos_kiosk/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[ This file must be present and contains the usage instructions
for end-users. As all other rst files included in the README,
it MUST NOT contain reStructuredText sections
only body text (paragraphs, lists, tables, etc). Should you need
a more elaborate structure to explain the addon, please create a
Sphinx documentation (which may include this file as a "quick start"
section). ]

To use this module, you need to:

#. Go to ...
Loading
Loading