Files
odoo_source/addons/point_of_sale/controllers/web_editor.py
T
Lucas Perais c24bc92173 [ADD] point_of_sale: add support for customer facing display (#15302)
A customer facing display is any monitor that can be connected through
HDMI on the POSBox. When enabling the customer facing display option the
customer will get a realtime overview of their current order, what they
have to pay and the change they should receive.

What is displayed on the customer facing display is fully customizeable
through web_editor, two snippets are provided that will be dynamically
updated (Order Block, Payment Info Block) as the order changes in the
POS.

The POSBox handles the live updates through hw_screen.

The HTML that eventually gets sent to hw_screen contains references to
remote resources. All of these remote resources are available on the
Odoo server, no other external connections have to be made. Resources
that are unavailable for the POSBox (like product images) are base64
encoded and included in the HTML. This is accomplished by using the BASE
HTML tag. This does mean that the customer facing display will *not*
work with a POS client opened through localhost or 127.0.0.1. The POS
has to be opened through an IP address (or URL) the POSBox can reach.

Courtesy of JOV, LPE, GED and MAT
2017-03-21 11:49:50 +01:00

19 lines
907 B
Python

# -*- coding: utf-8 -*-
from odoo import http
from odoo.http import request
from odoo.addons.web_editor.controllers.main import Web_Editor
class WebEditorPointOfSale(Web_Editor):
@http.route('/point_of_sale/field/customer_facing_display_template', type='http', auth="user")
def get_field_text_html(self, model=None, res_id=None, field=None, callback=None, **kwargs):
kwargs['snippets'] = '/point_of_sale/snippets'
kwargs['template'] = 'point_of_sale.FieldTextHtml'
extra_head = request.env.ref('point_of_sale.extra_head').render(None)
return self.FieldTextHtml(model=model, res_id=res_id, field=field, callback=callback, head=extra_head, **kwargs)
@http.route(['/point_of_sale/snippets'], type='json', auth="user", website=True)
def get_snippets(self):
return request.env.ref('point_of_sale.customer_facing_display_snippets').render(None)