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 = $('
').html(renderedHtml); + $(this.env.pos.customer_display.document.body).html($renderedHtml.find('.pos-customer_facing_display')); + $(this.env.pos.customer_display.document.head).html($renderedHtml.find('.resources').html()); + } + async onClickProxy() { try { const renderedHtml = await this.env.pos.render_html_for_customer_facing_display(); const ownership = await this.env.pos.proxy.take_ownership_over_client_screen( @@ -47,6 +62,10 @@ odoo.define('point_of_sale.ClientScreenButton', function(require) { } } _start() { + if (this.local) { + return; + } + const self = this; async function loop() { if (self.env.pos.proxy.posbox_supports_display) { diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index c23aafbafb6..0f0fe47e80e 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -299,7 +299,7 @@ exports.PosModel = Backbone.Model.extend({ self.config.iface_electronic_scale || self.config.iface_print_via_proxy || self.config.iface_scan_via_proxy || - self.config.iface_customer_facing_display); + self.config.iface_customer_facing_display_via_proxy); self.db.set_uuid(self.config.uuid); self.set_cashier(self.get_cashier()); @@ -865,7 +865,14 @@ exports.PosModel = Backbone.Model.extend({ send_current_order_to_customer_facing_display: function() { var self = this; this.render_html_for_customer_facing_display().then(function (rendered_html) { - self.proxy.update_customer_facing_display(rendered_html); + if (self.env.pos.customer_display) { + var $renderedHtml = $('
').html(rendered_html); + $(self.env.pos.customer_display.document.body).html($renderedHtml.find('.pos-customer_facing_display')); + var orderlines = $(self.env.pos.customer_display.document.body).find('.pos_orderlines_list'); + orderlines.scrollTop(orderlines.prop("scrollHeight")); + } else if (self.env.pos.proxy.posbox_supports_display) { + self.proxy.update_customer_facing_display(rendered_html); + } }); }, diff --git a/addons/point_of_sale/static/src/xml/CustomerFacingDisplay/CustomerFacingDisplayOrder.xml b/addons/point_of_sale/static/src/xml/CustomerFacingDisplay/CustomerFacingDisplayOrder.xml index f657179b757..ffc336d1825 100644 --- a/addons/point_of_sale/static/src/xml/CustomerFacingDisplay/CustomerFacingDisplayOrder.xml +++ b/addons/point_of_sale/static/src/xml/CustomerFacingDisplay/CustomerFacingDisplayOrder.xml @@ -4,7 +4,11 @@
- + + + + +
@@ -37,9 +41,7 @@ -
- Odoo Logo -
+
diff --git a/addons/point_of_sale/views/pos_config_view.xml b/addons/point_of_sale/views/pos_config_view.xml index 87588c954ed..99981cd5c50 100644 --- a/addons/point_of_sale/views/pos_config_view.xml +++ b/addons/point_of_sale/views/pos_config_view.xml @@ -208,8 +208,8 @@
-
@@ -225,6 +225,17 @@ +
+
+ +
+
+
+