[FIX] l10n_in_pos: receipt rendering error when company has no country

To reproduce:

1. Start with empty instance with point_of_sale (no demo).
2. Install Indian localization from Invoicing.
3. Start a pos session with that config.
4. Sell a product.
5. Assign a customer to the order.
6. Invoice the order during payment.
7. Validate. [BUG] Empty receipt is shown in the receipt screen.

This is because of empty country field of the pos.config's company.
We modify the check for country code in the receipt template to
account for empty country as fix.

closes odoo/odoo#60814

X-original-commit: 86423e2da90e1d023bd616cbc719c80f087a4206
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Signed-off-by: Joseph Caburnay (jcb) <caburj@users.noreply.github.com>
This commit is contained in:
Joseph Caburnay
2020-10-27 11:15:26 +00:00
parent e380ed010e
commit 6b443b7981
@@ -2,7 +2,7 @@
<templates id="template" xml:space="preserve">
<t t-name="OrderReceipt" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('orderlines')]" position="before">
<t t-if="receipt.client and env.pos.company.country.code == 'IN'">
<t t-if="receipt.client and env.pos.company.country and env.pos.company.country.code == 'IN'">
<div class="pos-receipt-center-align">
<div><t t-esc="receipt.client.name" /></div>
<t t-if="receipt.client.phone">
@@ -16,7 +16,7 @@
</t>
</xpath>
<xpath expr="//WrappedProductNameLines" position="after">
<t t-if="line.l10n_in_hsn_code and env.pos.company.country.code == 'IN'">
<t t-if="line.l10n_in_hsn_code and env.pos.company.country and env.pos.company.country.code == 'IN'">
<div class="pos-receipt-left-padding">
<span>HSN Code: </span>
<t t-esc="line.l10n_in_hsn_code"/>