Browse Source

Dec 9 [UPDT] : Updated 'website_restrict_country'

pull/301/merge
AjmalCybro 5 months ago
parent
commit
d9d51ac9a9
  1. 2
      website_restrict_country/__manifest__.py
  2. 6
      website_restrict_country/doc/RELEASE_NOTES.md
  3. 1
      website_restrict_country/models/website.py
  4. 50
      website_restrict_country/views/website_templates.xml

2
website_restrict_country/__manifest__.py

@ -20,7 +20,7 @@
############################################################################# #############################################################################
{ {
'name': 'Website Restrict Country', 'name': 'Website Restrict Country',
'version': '16.0.1.0.0', 'version': '16.0.1.1.0',
'category': 'Website', 'category': 'Website',
'summary': """ The Website Restrict Country module allows you to set 'summary': """ The Website Restrict Country module allows you to set
restrictions for products that are unavailable in certain countries. restrictions for products that are unavailable in certain countries.

6
website_restrict_country/doc/RELEASE_NOTES.md

@ -4,3 +4,9 @@
#### Version 16.0.1.0.0 #### Version 16.0.1.0.0
##### ADD ##### ADD
- Initial Commit for Website Restrict Country - Initial Commit for Website Restrict Country
#### 11.01.2024
#### Version 16.0.1.1.0
##### UPDATE
- Fixed the issues in the 'Buy now' button and cart page

1
website_restrict_country/models/website.py

@ -35,5 +35,6 @@ class Website(models.Model):
comodel_name='res.country', comodel_name='res.country',
help='Set a default country') help='Set a default country')
cart_message = fields.Char(string="Cart Message", cart_message = fields.Char(string="Cart Message",
default='This product is not available in your country',
help='Custom message display if the product ' help='Custom message display if the product '
'is not available') 'is not available')

50
website_restrict_country/views/website_templates.xml

@ -18,28 +18,29 @@
<template id="country_selection"> <template id="country_selection">
<t t-if="country"> <t t-if="country">
<li class="nav-item dropdown o_no_autohide_item js_countrymenu"> <li class="nav-item dropdown o_no_autohide_item js_countrymenu">
<a href="#" role="button" data-bs-toggle="dropdown" id="a_select" <a href="#" role="button" data-bs-toggle="dropdown"
class="dropdown-toggle nav-link fw-bold"> id="a_select"
<img id="img_code_vat" class="js_img_country_code" class="dropdown-toggle nav-link fw-bold">
t-att-src="country.image_url" <img id="img_code_vat" class="js_img_country_code"
width="30" height="20"/> t-att-src="country.image_url"
</a> width="30" height="20"/>
<div id="country_selection_menu" role="menu" </a>
class="dropdown-menu "> <div id="country_selection_menu" role="menu"
<t t-foreach="countries" t-as="country"> class="dropdown-menu ">
<a href="#" class="dropdown-item js_countries" <t t-foreach="countries" t-as="country">
t-att-id="country.code" <a href="#" class="dropdown-item js_countries"
t-att-data-country_id="country.id" t-att-id="country.code"
t-att-data-country_code="country.code" t-att-data-country_id="country.id"
t-att-data-country_image_url="country.image_url"> t-att-data-country_code="country.code"
<img t-att-data-country-id="country.id" t-att-data-country_image_url="country.image_url">
t-att-src="country.image_url" <img t-att-data-country-id="country.id"
width="30" height="20"/> t-att-src="country.image_url"
<span t-esc="country.name"/> width="30" height="20"/>
</a> <span t-esc="country.name"/>
</t> </a>
</div> </t>
</li> </div>
</li>
</t> </t>
</template> </template>
<!--website_sale.suggested_products_list inherited template --> <!--website_sale.suggested_products_list inherited template -->
@ -70,7 +71,7 @@
t-value="request.env['website'].get_current_website().default_country_id.id"/> t-value="request.env['website'].get_current_website().default_country_id.id"/>
<t t-set="product_select_country" <t t-set="product_select_country"
t-value="product.country_selection_ids.mapped('country_id').ids"/> t-value="product.country_selection_ids.mapped('country_id').ids"/>
<t t-if="current_select_country in product_select_country"> <t t-if="not product_select_country or current_select_country in product_select_country">
<a role="button" <a role="button"
t-attf-class="btn btn-outline-primary o_we_buy_now ms-1 #{'btn-lg' if ctaSizeBig else ''}" t-attf-class="btn btn-outline-primary o_we_buy_now ms-1 #{'btn-lg' if ctaSizeBig else ''}"
href="#"> href="#">
@ -80,6 +81,7 @@
</t> </t>
</xpath> </xpath>
</template> </template>
<!-- website_sale.short_cart_summary inherited template --> <!-- website_sale.short_cart_summary inherited template -->
<template id="checkout_process_country_restriction" <template id="checkout_process_country_restriction"
name="Checkout Process Restriction" name="Checkout Process Restriction"
@ -88,7 +90,7 @@
<t t-set="availability" <t t-set="availability"
t-value="website_sale_order.website_order_line.mapped('product_id.product_tmpl_id.country_availability')"/> t-value="website_sale_order.website_order_line.mapped('product_id.product_tmpl_id.country_availability')"/>
<t t-set="product_select_country" <t t-set="product_select_country"
t-value="website_sale_order.get_common_country_list()"/> 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 t-set="current_select_country"
t-value="request.env['website'].get_current_website().default_country_id.id"/> 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"> <t t-if="all(country=='all' for country in availability) or current_select_country in product_select_country">

Loading…
Cancel
Save