You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
7.1 KiB
131 lines
7.1 KiB
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<!-- Inherited template for header-->
|
|
<template id="template_header_default"
|
|
inherit_id="website_sale.template_header_default">
|
|
<xpath expr="//t[@t-call='website_sale.header_cart_link']"
|
|
position="after">
|
|
<t t-if="request.env['website'].browse(request.website.id).default_country_id">
|
|
<t t-set="countries"
|
|
t-value="request.env['website'].browse(request.website.id).country_ids"/>
|
|
<t t-set="country"
|
|
t-value="request.env['website'].browse(request.website.id).default_country_id"/>
|
|
|
|
<div class="country_select_m">
|
|
<li class="nav-item dropdown o_no_autohide_item js_countrymenu">
|
|
<a href="#" role="button"
|
|
class="dropdown-toggle nav-link fw-bold"
|
|
aria-expanded="false">
|
|
<img id="img_code_vat" class="js_img_country_code"
|
|
t-att-src="country.image_url" width="30"
|
|
height="20"/>
|
|
<span t-esc="country.name"/>
|
|
</a>
|
|
<div id="country_selection_menu" role="menu"
|
|
class="dropdown-menu dropdown-menu-end">
|
|
<t t-foreach="countries" t-as="country">
|
|
<a href="#" class="dropdown-item js_countries"
|
|
t-att-id="country.code"
|
|
t-att-data-country_id="country.id"
|
|
t-att-data-country_code="country.code"
|
|
t-att-data-country_image_url="country.image_url">
|
|
<img t-att-data-country-id="country.id"
|
|
t-att-src="country.image_url"
|
|
width="30" height="20"/>
|
|
<span t-esc="country.name"/>
|
|
</a>
|
|
</t>
|
|
</div>
|
|
</li>
|
|
</div>
|
|
</t>
|
|
</xpath>
|
|
</template>
|
|
<!-- Inherited template of suggested products -->
|
|
<template id="cart_summary_inherit_website_country_restriction"
|
|
inherit_id="website_sale.suggested_products_list">
|
|
<xpath expr="//td[hasclass('td-product_name')]" position="inside">
|
|
<t t-set="country_availability"
|
|
t-value="line.product_id.product_tmpl_id.country_availability"/>
|
|
<t t-set="product_select_country"
|
|
t-value="line.product_id.product_tmpl_id.country_selection_ids.mapped('country_id').ids"/>
|
|
<t t-set="current_select_country"
|
|
t-value="request.env['website'].get_current_website().default_country_id.id"/>
|
|
<t t-set="message_cart"
|
|
t-value="request.env['website'].get_current_website().cart_message"/>
|
|
<t t-if="current_select_country not in product_select_country and country_availability == 'selected' and message_cart">
|
|
<div class="alert alert-warning mt-3" role="alert">
|
|
<t t-esc="message_cart"/>
|
|
</div>
|
|
</t>
|
|
</xpath>
|
|
</template>
|
|
<!--Inherited template of Buy now -->
|
|
<template id="buy_now_restriction" name="Buy Now Restriction"
|
|
inherit_id="website_sale.product_buy_now">
|
|
<xpath expr="//a[contains(@t-attf-class, 'o_we_buy_now')]"
|
|
position="replace">
|
|
<t t-set="current_select_country"
|
|
t-value="request.env['website'].get_current_website().default_country_id.id"/>
|
|
<t t-set="product_select_country"
|
|
t-value="product.country_selection_ids.mapped('country_id').ids"/>
|
|
<t t-if="current_select_country in product_select_country">
|
|
<a role="button"
|
|
t-attf-class="btn btn-outline-primary o_we_buy_now ms-1 #{'btn-lg' if ctaSizeBig else ''}"
|
|
href="#">
|
|
<i class="fa fa-bolt me-2"/>
|
|
<span style="font-weight:bold">BUY NOW</span>
|
|
</a>
|
|
</t>
|
|
</xpath>
|
|
</template>
|
|
<!-- Inherited template of cart summary -->
|
|
<template id="checkout_process_country_restriction"
|
|
name="Checkout Process Restriction"
|
|
inherit_id="website_sale.short_cart_summary">
|
|
<xpath expr="//a[hasclass('d-xl-inline-block')]" position="replace">
|
|
<t t-set="availability"
|
|
t-value="website_sale_order.website_order_line.mapped('product_id.product_tmpl_id.country_availability')"/>
|
|
<t t-set="product_select_country"
|
|
t-value="website_sale_order.website_order_line.product_id.product_tmpl_id.country_selection_ids.mapped('country_id').ids"/>
|
|
<t t-set="current_select_country"
|
|
t-value="request.env['website'].get_current_website().default_country_id.id"/>
|
|
<t t-if="all(country=='all' for country in availability) or current_select_country in product_select_country">
|
|
<a role="button"
|
|
t-if="website_sale_order and website_sale_order.website_order_line"
|
|
class="btn btn-primary float-right d-none d-xl-inline-block"
|
|
href="/shop/checkout?express=1">
|
|
<span class="">Process Checkout</span>
|
|
<span class="fa fa-chevron-right"/>
|
|
</a>
|
|
</t>
|
|
<t t-else="current_select_country not in product_select_country">
|
|
<div class="alert alert-danger" role="alert">Restricted Process
|
|
to Checkout
|
|
</div>
|
|
</t>
|
|
</xpath>
|
|
</template>
|
|
<!-- Inherited template of cart-->
|
|
<template id="proceed_to_checkout_country_restriction"
|
|
name="Proceed to Checkout Restriction"
|
|
inherit_id="website_sale.cart">
|
|
<xpath expr="//a[hasclass('float-right')]" position="replace">
|
|
<t t-set="availability"
|
|
t-value="website_sale_order.website_order_line.mapped('product_id.product_tmpl_id.country_availability')"/>
|
|
<t t-set="product_select_country"
|
|
t-value="website_sale_order.website_order_line.product_id.product_tmpl_id.country_selection_ids.mapped('country_id').ids"/>
|
|
<t t-set="current_select_country"
|
|
t-value="request.env['website'].get_current_website().default_country_id.id"/>
|
|
<t t-if="all(country=='all' for country in availability) or current_select_country in product_select_country">
|
|
<a role="button"
|
|
t-if="website_sale_order and website_sale_order.website_order_line"
|
|
class="btn btn-primary float-right d-none d-xl-inline-block"
|
|
href="/shop/checkout?express=1">
|
|
<span class="">Process Checkout</span>
|
|
<span class="fa fa-chevron-right"/>
|
|
</a>
|
|
</t>
|
|
</xpath>
|
|
</template>
|
|
</odoo>
|
|
|