From f4200f376bbd90e919073100170853ada4ad71fc Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Tue, 13 Jun 2017 20:05:55 -0700 Subject: [PATCH] [FIX] point_of_sale: avoid '414 Request-URI Too Large' on config form Inspired by d7939282e906cd547db837770f139a6ab02f19ff. Without this you end up with a URI with a length of over 50000 characters. The default template doesn't actually use any fields on pos.config so we could theoretically get rid of everything. But because it's easy enough we just get rid of relational fields and the customer_facing_display_html field itself which make up the vast majority of the URI. --- .../static/src/js/field_text_html.js | 20 +++++++++++++++++++ addons/point_of_sale/views/pos_templates.xml | 6 ++++++ 2 files changed, 26 insertions(+) create mode 100644 addons/point_of_sale/static/src/js/field_text_html.js diff --git a/addons/point_of_sale/static/src/js/field_text_html.js b/addons/point_of_sale/static/src/js/field_text_html.js new file mode 100644 index 00000000000..27b378801c9 --- /dev/null +++ b/addons/point_of_sale/static/src/js/field_text_html.js @@ -0,0 +1,20 @@ +odoo.define('point_of_sale.fieldtexthtml', function (require) { + 'use strict'; + + var FieldTextHtml = require('web_editor.backend').FieldTextHtml; + + FieldTextHtml.include({ + // avoid '414 Request-URI Too Large' errors to + // /point_of_sale/field/customer_facing_display_template by + // filtering out biggest fields + getDatarecord: function () { + var datarecord = this._super(); + if (this.model === 'pos.config') { + datarecord = _.omit(datarecord, function (val, key) { + return _.isObject(val) || key === 'customer_facing_display_html'; + }); + } + return datarecord; + }, + }); +}); diff --git a/addons/point_of_sale/views/pos_templates.xml b/addons/point_of_sale/views/pos_templates.xml index 79a214758d7..110b3fd03d2 100644 --- a/addons/point_of_sale/views/pos_templates.xml +++ b/addons/point_of_sale/views/pos_templates.xml @@ -72,6 +72,12 @@ +