diff --git a/addons/pos_discount/i18n/pos_discount.pot b/addons/pos_discount/i18n/pos_discount.pot index 50ac5572f33..57ba3ea7e2c 100644 --- a/addons/pos_discount/i18n/pos_discount.pot +++ b/addons/pos_discount/i18n/pos_discount.pot @@ -46,6 +46,13 @@ msgstr "" msgid "Discount Product" msgstr "" +#. module: pos_discount +#. openerp-web +#: code:addons/pos_discount/static/src/js/discount.js:28 +#, python-format +msgid "No discount product found" +msgstr "" + #. module: pos_discount #: model:ir.model.fields,field_description:pos_discount.field_pos_config_iface_discount msgid "Order Discounts" @@ -56,6 +63,13 @@ msgstr "" msgid "The default discount percentage" msgstr "" +#. module: pos_discount +#. openerp-web +#: code:addons/pos_discount/static/src/js/discount.js:29 +#, python-format +msgid "The discount product seems misconfigured. Make sure it is flagged as 'Can be Sold' and 'Available in Point of Sale'." +msgstr "" + #. module: pos_discount #: model:ir.model.fields,help:pos_discount.field_pos_config_discount_product_id msgid "The product used to model the discount." diff --git a/addons/pos_discount/static/src/js/discount.js b/addons/pos_discount/static/src/js/discount.js index e77e4559e0c..771992bb01b 100644 --- a/addons/pos_discount/static/src/js/discount.js +++ b/addons/pos_discount/static/src/js/discount.js @@ -23,6 +23,13 @@ var DiscountButton = screens.ActionButtonWidget.extend({ var order = this.pos.get_order(); var lines = order.get_orderlines(); var product = this.pos.db.get_product_by_id(this.pos.config.discount_product_id[0]); + if (product === undefined) { + this.gui.show_popup('error', { + title : _t("No discount product found"), + body : _t("The discount product seems misconfigured. Make sure it is flagged as 'Can be Sold' and 'Available in Point of Sale'."), + }); + return; + } // Remove existing discounts var i = 0;