[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) <jpp@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2020-04-28 13:07:20 +00:00
parent f731cc3de3
commit feb830e9f7
@@ -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 () {