pos_shift_close/controllers/main.py

14 lines
742 B
Python

from odoo import http
from odoo.http import request
from odoo.addons.point_of_sale.controllers.main import PosController
class PosControllerInherit(PosController):
@http.route(["/pos/ui/<config_id>", "/pos/ui/<config_id>/<path:subpath>"], auth="user", type='http')
def pos_web(self, config_id=False, from_backend=False, subpath=None, **k):
if config_id:
pos_config = request.env['pos.config'].sudo().browse(int(config_id))
if pos_config.exists() and not pos_config.has_active_session and not from_backend:
return request.redirect('/odoo/action-point_of_sale.action_client_pos_menu')
return super().pos_web(config_id=config_id, from_backend=from_backend, subpath=subpath, **k)