[FIX] pos_*: properly check country from company

pos_*: l10n_ae_pos,l10n_co_pos,l10n_fr_pos_cert

In many pos l10n addons, we assume that country is present in the company, and
this is a wrong assumption. Thanks to the runbot error that we are able to
detect these mistakes in the code. In this commit, we fix the issue by checking
the presence of country first before actually accession the country code.

Runbot Error: 20917

closes odoo/odoo#126117

X-original-commit: 172a5bc8628f8b774d9738c05c2eb7b0ef4db5ae
Related: odoo/enterprise#43019
Signed-off-by: Robin Heinz (rhe) <rhe@odoo.com>
This commit is contained in:
Joseph Caburnay
2023-06-23 16:35:35 +02:00
parent 8618d34953
commit 667d056b63
3 changed files with 3 additions and 3 deletions
@@ -3,7 +3,7 @@
<t t-name="l10n_ae_pos.OrderReceiptVAT" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension" owl="1">
<xpath expr="//div[@id='post_receipt_taxes_container']" position="replace">
<div id='post_receipt_taxes_container'>
<t t-if="pos.company.country.code == 'AE'">VAT</t>
<t t-if="pos.company.country?.code == 'AE'">VAT</t>
<t t-else="">Total Taxes</t>
<span t-esc="env.utils.formatCurrency(receipt.total_tax)" class="pos-receipt-right-align"/>
</div>
+1 -1
View File
@@ -6,7 +6,7 @@ import { patch } from "@web/core/utils/patch";
patch(PosStore.prototype, "l10n_co_pos.PosStore", {
is_colombian_country() {
return this.company.country.code === "CO";
return this.company.country?.code === "CO";
},
});
+1 -1
View File
@@ -17,7 +17,7 @@ patch(PosStore.prototype, "l10n_fr_pos_cert.PosStore", {
});
return false;
}
return french_countries.includes(this.company.country.code);
return french_countries.includes(this.company.country?.code);
},
disallowLineQuantityChange() {
const result = this._super(...arguments);