File: customer_display.py

package info (click to toggle)
odoo 18.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 878,716 kB
  • sloc: javascript: 927,937; python: 685,670; xml: 388,524; sh: 1,033; sql: 415; makefile: 26
file content (21 lines) | stat: -rw-r--r-- 869 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import odoo
from odoo import http
from odoo.http import request
import odoo.exceptions


class PosCustomerDisplay(http.Controller):
    @http.route("/pos_customer_display/<id_>/<access_token>", auth="public", type="http", website=True)
    def pos_customer_display(self, id_, access_token, **kw):
        pos_config_sudo = request.env["pos.config"].sudo().browse(int(id_))
        if not odoo.tools.consteq(access_token, pos_config_sudo.access_token) or pos_config_sudo.customer_display_type == "none":
            raise odoo.exceptions.AccessDenied()
        return request.render(
            "point_of_sale.customer_display_index",
            {
                "session_info": {
                    **request.env["ir.http"].get_frontend_session_info(),
                    **pos_config_sudo._get_customer_display_data(),
                },
            },
        )