From ea5912fedd57066026467410e52e95ca92b2727a Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 4 Sep 2018 13:44:48 +0200 Subject: [PATCH] [FIX] point_of_sale: pricelist - Create 2 pricelists A and B. Pricelist B relies on A. - Make B available in the POS, but not A - Start a POS session The user faces a black screen without any information on the error. We add a simple alert so that the user knowns the source of the problem. opw-1874397 --- addons/point_of_sale/i18n/point_of_sale.pot | 7 +++++++ addons/point_of_sale/static/src/js/models.js | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/addons/point_of_sale/i18n/point_of_sale.pot b/addons/point_of_sale/i18n/point_of_sale.pot index 99621fb1a13..dad53ddda14 100644 --- a/addons/point_of_sale/i18n/point_of_sale.pot +++ b/addons/point_of_sale/i18n/point_of_sale.pot @@ -412,6 +412,13 @@ msgstr "" msgid "Amount total" msgstr "" +#. module: point_of_sale +#. openerp-web +#: code:addons/point_of_sale/static/src/js/models.js:1244 +#, python-format +msgid "An error occurred when loading product prices. Make sure all pricelists are available in the POS." +msgstr "" + #. module: point_of_sale #: model:ir.model.fields,help:point_of_sale.field_pos_config_name msgid "An internal identification of the point of sale." diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 02d8725953c..185e41332a5 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1237,6 +1237,15 @@ exports.Product = Backbone.Model.extend({ var self = this; var date = moment().startOf('day'); + // In case of nested pricelists, it is necessary that all pricelists are made available in + // the POS. Display a basic alert to the user in this case. + if (pricelist === undefined) { + alert(_t( + 'An error occurred when loading product prices. ' + + 'Make sure all pricelists are available in the POS.' + )); + } + var category_ids = []; var category = this.categ; while (category) {