[FIX] point_of_sale: correctly assign and display html for the customer display
Commit f4200f376b 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
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -145,6 +145,13 @@
|
||||
<label string="Customer Display" for="iface_customer_facing_display" class="col-md-3 o_light_label"/>
|
||||
<field name="iface_customer_facing_display"/>
|
||||
</div>
|
||||
<field name="customer_facing_display_html" invisible="1"/>
|
||||
<div class="text-muted" attrs="{'invisible' : ['|', ('iface_customer_facing_display', '=', False), '&', ('id', '!=', False), ('customer_facing_display_html', '!=', '')]}">Save this configuration to see and edit the customer display</div>
|
||||
<div class="row mt16 o_settings_container" attrs="{'invisible' : ['|', '|',('iface_customer_facing_display', '=', False), ('id', '=', False), ('customer_facing_display_html', '=', '')]}">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<field name="customer_facing_display_html" widget="html_frame" nolabel="1" options="{'editor_url': '/point_of_sale/field/customer_facing_display_template'}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -164,11 +171,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt16 o_settings_container" attrs="{'invisible' : [('iface_customer_facing_display', '=', False)]}">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<field name="customer_facing_display_html" widget="html_frame" nolabel="1" options="{'editor_url': '/point_of_sale/field/customer_facing_display_template'}"/>
|
||||
</div>
|
||||
</div>
|
||||
<h2>Taxes</h2>
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box" title="Choose a specific tax regime at the order depending on the kind of customer (tax exempt, onsite vs. takeaway, etc.).">
|
||||
|
||||
Reference in New Issue
Block a user