diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index a92b0fc932b..ec352c7fdcc 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -121,7 +121,9 @@ class PosConfig(models.Model): iface_cashdrawer = fields.Boolean(string='Cashdrawer', help="Automatically open the cashdrawer.") iface_electronic_scale = fields.Boolean(string='Electronic Scale', help="Enables Electronic Scale integration.") iface_vkeyboard = fields.Boolean(string='Virtual KeyBoard', help=u"Don’t turn this option on if you take orders on smartphones or tablets. \n Such devices already benefit from a native keyboard.") - iface_customer_facing_display = fields.Boolean(string='Customer Facing Display', help="Show checkout to customers with a remotely-connected screen.") + iface_customer_facing_display = fields.Boolean(compute='_compute_customer_facing_display') + iface_customer_facing_display_via_proxy = fields.Boolean(string='Customer Facing Display', help="Show checkout to customers with a remotely-connected screen.") + iface_customer_facing_display_local = fields.Boolean(string='Local Customer Facing Display', help="Show checkout to customers.") iface_print_via_proxy = fields.Boolean(string='Print via Proxy', help="Bypass browser printing and prints via the hardware proxy.") iface_scan_via_proxy = fields.Boolean(string='Scan via Proxy', help="Enable barcode scanning with a remotely connected barcode scanner and card swiping with a Vantiv card reader.") iface_big_scrollbars = fields.Boolean('Large Scrollbars', help='For imprecise industrial touchscreens.') @@ -313,6 +315,11 @@ class PosConfig(models.Model): else: config.selectable_categ_ids = self.env['pos.category'].search([]) + @api.depends('iface_customer_facing_display_via_proxy', 'iface_customer_facing_display_local') + def _compute_customer_facing_display(self): + for config in self: + config.iface_customer_facing_display = config.iface_customer_facing_display_via_proxy or config.iface_customer_facing_display_local + @api.constrains('cash_control') def _check_session_state(self): open_session = self.env['pos.session'].search([('config_id', '=', self.id), ('state', '!=', 'closed')]) @@ -422,7 +429,7 @@ class PosConfig(models.Model): self.iface_electronic_scale = False self.iface_cashdrawer = False self.iface_print_via_proxy = False - self.iface_customer_facing_display = False + self.iface_customer_facing_display_via_proxy = False @api.onchange('tax_regime') def _onchange_tax_regime(self): diff --git a/addons/point_of_sale/static/src/css/customer_facing_display.css b/addons/point_of_sale/static/src/css/customer_facing_display.css index 824d220b700..3ca48b211a1 100644 --- a/addons/point_of_sale/static/src/css/customer_facing_display.css +++ b/addons/point_of_sale/static/src/css/customer_facing_display.css @@ -261,16 +261,12 @@ body .pos-customer_facing_display .pos-payment_info .pos-payment_info_details .p line-height: 1.3; } body .pos-customer_facing_display .pos-payment_info .pos-payment_info_details .pos-odoo_logo_container { - text-align: right; + background-image: url(/web/static/src/img/logo_inverse_white_206px.png); + background-position: right top; + background-size: contain; + background-repeat: no-repeat; + height: 1.5vw; margin-top: 10%; - -webkit-box-flex: 0 1 auto; - -webkit-flex: 0 1 auto; - -moz-box-flex: 0 1 auto; - -ms-flex: 0 1 auto; - flex: 0 1 auto; -} -body .pos-customer_facing_display .pos-payment_info .pos-payment_info_details .pos-odoo_logo_container img { - max-width: 40px; } @media all and (orientation: portrait) { body .pos-customer_facing_display { diff --git a/addons/point_of_sale/static/src/js/Chrome.js b/addons/point_of_sale/static/src/js/Chrome.js index 41bb4e28d58..ba72e33e00e 100644 --- a/addons/point_of_sale/static/src/js/Chrome.js +++ b/addons/point_of_sale/static/src/js/Chrome.js @@ -86,9 +86,7 @@ odoo.define('point_of_sale.Chrome', function(require) { // GETTERS // get clientScreenButtonIsShown() { - return ( - this.env.pos.config.use_proxy && this.env.pos.config.iface_customer_facing_display - ); + return this.env.pos.config.iface_customer_facing_display; } /** * Startup screen can be based on pos config so the startup screen diff --git a/addons/point_of_sale/static/src/js/ChromeWidgets/ClientScreenButton.js b/addons/point_of_sale/static/src/js/ChromeWidgets/ClientScreenButton.js index 38403b588f5..ce1033ad5e8 100644 --- a/addons/point_of_sale/static/src/js/ChromeWidgets/ClientScreenButton.js +++ b/addons/point_of_sale/static/src/js/ChromeWidgets/ClientScreenButton.js @@ -9,7 +9,8 @@ odoo.define('point_of_sale.ClientScreenButton', function(require) { class ClientScreenButton extends PosComponent { constructor() { super(...arguments); - this.state = useState({ status: 'failure' }); + this.local = this.env.pos.config.iface_customer_facing_display_local && !this.env.pos.config.iface_customer_facing_display_proxy; + this.state = useState({ status: this.local ? 'success' : 'failure' }); this._start(); } get message() { @@ -20,7 +21,21 @@ odoo.define('point_of_sale.ClientScreenButton', function(require) { not_found: this.env._t('Client Screen Unsupported. Please upgrade the IoT Box'), }[this.state.status]; } - async onClick() { + onClick() { + if (this.local) { + return this.onClickLocal(); + } else { + return this.onClickProxy(); + } + } + async onClickLocal() { + this.env.pos.customer_display = window.open('', 'Customer Display', 'height=600,width=900'); + const renderedHtml = await this.env.pos.render_html_for_customer_facing_display(); + var $renderedHtml = $('
-