From feb830e9f7530084eba4301c04a8e14eea92b143 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Tue, 28 Apr 2020 10:57:31 +0000 Subject: [PATCH] [FIX] l10n_fr_pos_cert: traceback if company don't have country - Install PoS and "l10n_fr_pos_cert"; - Erase the country in the current company; - Open a PoS session; - Click on any product. Before this commit, a JavaScript traceback was raised: TypeError: Cannot read property 'code' of null. Now, an error message is raise, that informs the user that the company don't have country setted. opw-2241993 closes odoo/odoo#50320 X-original-commit: 5ed4b0cb54a20756e44c492cb5a67ff7d40f452c Signed-off-by: Jorge Pinna Puissant (jpp) --- addons/l10n_fr_pos_cert/static/src/js/pos.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/l10n_fr_pos_cert/static/src/js/pos.js b/addons/l10n_fr_pos_cert/static/src/js/pos.js index 04d5d2843ab..e724ad149da 100644 --- a/addons/l10n_fr_pos_cert/static/src/js/pos.js +++ b/addons/l10n_fr_pos_cert/static/src/js/pos.js @@ -15,6 +15,13 @@ var _super_posmodel = models.PosModel.prototype; models.PosModel = models.PosModel.extend({ is_french_country: function(){ var french_countries = ['FR', 'MF', 'MQ', 'NC', 'PF', 'RE', 'GF', 'GP', 'TF']; + if (!this.company.country) { + this.gui.show_popup("error", { + 'title': _t("Missing Country"), + 'body': _.str.sprintf(_t('The company %s doesn\'t have a country set.'), this.company.name), + }); + return false; + } return _.contains(french_countries, this.company.country.code); }, delete_current_order: function () {