diff --git a/addons/pos_discount/i18n/pos_discount.pot b/addons/pos_discount/i18n/pos_discount.pot index bf6956ca4ef82331f4d98889c87c30cfb0f94bdd..71ad94728b1095901226ea23fd8f171f297779d8 100644 --- a/addons/pos_discount/i18n/pos_discount.pot +++ b/addons/pos_discount/i18n/pos_discount.pot @@ -45,6 +45,13 @@ msgstr "" msgid "Discounts" 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" @@ -55,6 +62,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 7ef38d6ffdbc2349393a0c9996ac472b55591b28..f29cf7968451920a049ecdf7ab2adffb391c8778 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;