Skip to content

Commit

Permalink
[FIX] website_sale_checkout_country_vat: inherit the correct view
Browse files Browse the repository at this point in the history
This module happened to be working accidentally because [it was inheriting from a view that had another inheriting view which defined the necessary elements][1]; but that view can be disabled and then this module breaks.

Fixed by inheriting from the correct view.

Also benefits from OCA/website#720 by using readonly mode if that module is updated.

@Tecnativa TT17694

[1]: https://github.com/odoo/odoo/blob/6e99a89574d11811c03fe3cdc61922352a9610ea/addons/website_sale/views/templates.xml#L1296
  • Loading branch information
Jairo Llopis authored and CarlosRoca13 committed May 25, 2022
1 parent f44fdc9 commit 57e8436
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion website_sale_checkout_country_vat/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "Website Sale Checkout Country VAT",
"summary": "Autocomplete VAT in checkout process",
"version": "12.0.1.1.0",
"version": "12.0.1.2.0",
"category": "Website",
'website': 'https://www.tecnativa.com',
'author': 'Tecnativa, '
Expand Down
3 changes: 2 additions & 1 deletion website_sale_checkout_country_vat/views/templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3). -->
<odoo>

<template id="address" inherit_id="website_sale.address">
<template id="address" inherit_id="website_sale.address_b2b">
<xpath expr="//input[@name='vat']" position="replace">
<t t-call="website_snippet_country_dropdown.country_dropdown">
<t t-set="complete_field" t-value="'vat'"/>
Expand All @@ -14,6 +14,7 @@
<t t-set="default_country"
t-value="countries.search([('code', '=', default_value[:2])]) or countries.search([('id', '=', country_id and int(country_id) or False)])"/>
<t t-set="no_country_field_extra_classes" t-value="error.get('vat') and 'is-invalid' or ''"/>
<t t-set="readonly" t-value="'1' if 'vat' in checkout and checkout['vat'] and not can_edit_vat else None"/>
</t>
</xpath>
</template>
Expand Down

0 comments on commit 57e8436

Please sign in to comment.