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.
 
 
 
 
 

140 lines
7.4 KiB

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!--Templates for Country Selection menu-->
<template id="country_selection" name="Header Country Selection">
<t t-nocache="The Countries"
t-nocache-_icon="_icon"
t-nocache-_item_class="_item_class"
t-nocache-_link_class="_link_class"
t-nocache-_badge_class="_badge_class"
t-nocache-_icon_wrap_class="_icon_wrap_class"
t-nocache-_text_class="_text_class"
t-nocache-_text="_text">
<t t-set="countries"
t-value="request.env['website'].browse(request.website.id).country_ids"/>
<t t-if="countries">
<t t-set="country"
t-value="request.env['website'].browse(request.website.id).default_country_id"/>
<li class="nav-item dropdown o_no_autohide_item js_countrymenu">
<a href="#" role="button" data-bs-toggle="dropdown"
id="a_select"
class="dropdown-toggle nav-link fw-bold">
<img id="img_code_vat" class="js_img_country_code"
t-att-src="country.image_url"
width="30" height="20"/>
</a>
<div id="country_selection_menu" role="menu"
class="dropdown-menu">
<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>
</t>
</t>
</template>
<!--website_sale.template_header_default inherited template -->
<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-call="website_restrict_country.country_selection">
<t t-set="_icon" t-value="True"/>
<t t-set="_link_class"
t-value="'o_navlink_background btn position-relative rounded-circle p-1 text-center text-reset'"/>
<t t-set="_badge_class"
t-value="'position-absolute top-0 end-0 mt-n1 me-n1 rounded-pill'"/>
</t>
</xpath>
</template>
<!--website_sale.suggested_products_list inherited template -->
<template id="cart_summary_inherit_website_country_restriction"
inherit_id="website_sale.suggested_products_list">
<xpath expr="//div[hasclass('o_cart_suggested_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'">
<div class="text-warning">
<t t-esc="message_cart"/>
</div>
</t>
</xpath>
</template>
<!--website_sale.product_buy_now inherited template -->
<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 or not 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>
<!-- website_sale.cart_lines inherited template -->
<template id="add_cart_message"
name="Add Cart Message"
inherit_id="website_sale.cart_lines">
<xpath expr="//div[@id='cart_products']/div/t/div[hasclass('flex-grow-1')]/div"
position="after">
<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'">
<div class="text-warning">
<t t-esc="message_cart"/>
</div>
</t>
</xpath>
</template>
<!-- website_sale.navigation_buttons inherited template -->
<template id="proceed_to_checkout_country_restriction"
name="Proceed to Checkout Restriction"
inherit_id="website_sale.navigation_buttons">
<xpath expr="//t/t[2]" 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" name="website_sale_main_button"
t-attf-class="#{_cta_classes} btn btn-primary #{not website_sale_order._is_cart_ready() and 'disabled'} #{_form_send_navigation and 'order-lg-3 w-100 w-lg-auto ms-lg-auto' or 'w-100'}"
t-att-href="step_specific_values.get('main_button_href', '#')">
Checkout
<i class="fa fa-angle-right ms-2 fw-light"/>
</a>
</t>
</xpath>
</template>
</odoo>