[IMP] point_of_sale: Customer facing display without IoT Box
Make it possible to use a customer display without an IoT Box. closes odoo/odoo#57013 Taskid: 2328520 Related: odoo/enterprise#12918 Related: odoo/upgrade#1737 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = $('<div>').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) {
|
||||
|
||||
@@ -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 = $('<div>').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);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
+6
-4
@@ -4,7 +4,11 @@
|
||||
<t t-name="CustomerFacingDisplayHead">
|
||||
<div class="resources">
|
||||
<base t-att-href="origin"/>
|
||||
<link href="/point_of_sale/static/src/css/customer_facing_display.css" rel="stylesheet"/>
|
||||
<meta http-equiv="cache-control" content="no-cache" />
|
||||
<meta http-equiv="pragma" content="no-cache" />
|
||||
<link rel="stylesheet" type="text/css" href="/web/static/lib/bootstrap/css/bootstrap.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/web/static/lib/fontawesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="/point_of_sale/static/src/css/customer_facing_display.css"/>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
@@ -37,9 +41,7 @@
|
||||
<t t-call="CustomerFacingDisplayPaymentLines"/>
|
||||
|
||||
<!-- Odoo Logo -->
|
||||
<div class="pos-odoo_logo_container">
|
||||
<img src="/web/static/src/img/logo_inverse_white_206px.png" alt="Odoo Logo"/>
|
||||
</div>
|
||||
<div class="pos-odoo_logo_container"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -208,8 +208,8 @@
|
||||
<field name="iface_cashdrawer"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label string="Customer Display" for="iface_customer_facing_display" class="col-lg-4 o_light_label"/>
|
||||
<field name="iface_customer_facing_display"/>
|
||||
<label string="Customer Display" for="iface_customer_facing_display_via_proxy" class="col-lg-4 o_light_label"/>
|
||||
<field name="iface_customer_facing_display_via_proxy"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -225,6 +225,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="customer_display" class="col-12 col-lg-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="iface_customer_facing_display_local"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="iface_customer_facing_display_local" string="Customer Display"/>
|
||||
<div class="text-muted">
|
||||
Show checkout to customers through a second display
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="barcode_scanner" class="col-12 col-lg-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user