[FIX] point_of_sale: avoid '414 Request-URI Too Large' on config form

Inspired by d7939282e9. 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.
This commit is contained in:
Joren Van Onder
2017-06-15 21:33:57 -07:00
parent eb347e82f8
commit f4200f376b
2 changed files with 26 additions and 0 deletions
@@ -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;
},
});
});
@@ -72,6 +72,12 @@
</script>
</template>
<template id="pos_editor_fieldtexthtml_assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/point_of_sale/static/src/js/field_text_html.js"/>
</xpath>
</template>
<template id="pos_editor_assets" inherit_id="web_editor.assets_editor">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/point_of_sale/static/src/js/pos.web_editor.js"/>