[FIX] l10n_gcc_pos: avoid traceback if company has no country

There is a check done during the receipt generation in the pos that
checks the country code of the company, assuming it is set. But it
is possible to have a company without a country set so we need to handle
this use case.

X-original-commit: 19849c61f0f8b1cb3ddc588885953158482a079f
Part-of: odoo/odoo#104389
This commit is contained in:
Nicolas (vin)
2022-10-28 08:22:56 +02:00
committed by Laurent Smet
parent 6f92ff5e00
commit 6bc685def1
@@ -10,7 +10,8 @@ odoo.define('l10n_gcc_pos.OrderReceipt', function (require) {
get receiptEnv() {
let receipt_render_env = super.receiptEnv;
let receipt = receipt_render_env.receipt;
receipt.is_gcc_country = ['SA', 'AE', 'BH', 'OM', 'QA', 'KW'].includes(receipt_render_env.order.pos.company.country.code);
const country = receipt_render_env.order.pos.company.country;
receipt.is_gcc_country = ['SA', 'AE', 'BH', 'OM', 'QA', 'KW'].includes(country && country.code);
return receipt_render_env;
}
}