From 94cddf69e453ff4cb80a070d1d8b301b0a4b9298 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 4 Oct 2017 10:48:57 +0200 Subject: [PATCH] [FIX] point_of_sale: correctly assign and display html for the customer display Commit f4200f376bbd90e919073100170853ada4ad71fc aimed at avoiding 414 errors on too long uri. But it brought up something else: on a new pos.config, the customer display html was not set due to that commit meddeling with the iframe's url. This present commit forces the set up of the html field on create and write (according to the values, as usual) the price to pay is to not being able to edit the html right away --- addons/point_of_sale/models/pos_config.py | 7 +++++++ addons/point_of_sale/views/pos_config_view.xml | 12 +++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index 4df43d7be57..db88b7c6638 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -327,6 +327,9 @@ class PosConfig(models.Model): @api.model def create(self, values): + if values.get('is_posbox') and values.get('iface_customer_facing_display'): + if values.get('customer_facing_display_html') and not values['customer_facing_display_html'].strip(): + values['customer_facing_display_html'] = self._compute_default_customer_html() IrSequence = self.env['ir.sequence'].sudo() val = { 'name': _('POS Order %s') % values['name'], @@ -348,6 +351,10 @@ class PosConfig(models.Model): @api.multi def write(self, vals): + if (self.is_posbox or vals.get('is_posbox')) and (self.iface_customer_facing_display or vals.get('iface_customer_facing_display')): + facing_display = (self.customer_facing_display_html or vals.get('customer_facing_display_html') or '').strip() + if not facing_display: + vals['customer_facing_display_html'] = self._compute_default_customer_html() result = super(PosConfig, self).write(vals) self.sudo()._set_fiscal_position() self.sudo()._check_modules_to_install() diff --git a/addons/point_of_sale/views/pos_config_view.xml b/addons/point_of_sale/views/pos_config_view.xml index b778ea33cad..8563657ff77 100644 --- a/addons/point_of_sale/views/pos_config_view.xml +++ b/addons/point_of_sale/views/pos_config_view.xml @@ -145,6 +145,13 @@