Browse Source

Oct 08: [FIX] Bug Fixed 'website_restrict_country'

pull/347/head
Cybrosys Technologies 7 months ago
parent
commit
dee8539d92
  1. 2
      website_restrict_country/__manifest__.py
  2. 18
      website_restrict_country/controllers/website_restrict_country.py
  3. 5
      website_restrict_country/doc/RELEASE_NOTES.md
  4. 2
      website_restrict_country/security/ir.model.access.csv
  5. 4
      website_restrict_country/views/website_templates.xml

2
website_restrict_country/__manifest__.py

@ -21,7 +21,7 @@
###############################################################################
{
'name': 'Website Restrict Country',
'version': '17.0.1.0.0',
'version': '17.0.1.0.1',
'category': 'Website',
'summary': "The Website Restrict Country module allows you to set"
"restrictions for products that are unavailable in certain"

18
website_restrict_country/controllers/website_restrict_country.py

@ -24,18 +24,14 @@ from odoo.http import request
class WebsiteCountry(http.Controller):
"""
This controller used to pass the selected country to the corresponding
template
"""
@http.route('/website/countries', type='json', auth="user", website=True)
""" This controller used to pass the selected country to the corresponding
template. """
@http.route('/website/countries', type='json', auth="public", website=True)
def website_countries(self, country_id):
"""
This function used to search the country id, and it renders the
details of the selected country in to the template.
"""
country_id = request.env['res.country'].browse(int(country_id))
website_id = request.env['website'].browse(request.website.id)
""" This function used to search the country id, and it renders the
details of the selected country in to the template. """
country_id = request.env['res.country'].sudo().browse(int(country_id))
website_id = request.env['website'].sudo().browse(request.website.id)
website_id.default_country_id = country_id.id
response = http.Response(
template='website_restrict_country.country_selection',

5
website_restrict_country/doc/RELEASE_NOTES.md

@ -4,3 +4,8 @@
#### Version 17.0.1.0.0
##### ADD
- Initial Commit for Website Restrict Country
#### 07.10.2024
#### Version 17.0.1.0.1
##### BUGFIX
- Fixed the errors in selecting the country for portal and public users.

2
website_restrict_country/security/ir.model.access.csv

@ -1,2 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_country_details_user,access.country.details.user,model_country_details,base.group_user,1,1,1,1
access_res_country_user,access.res.country.user,base.model_res_country,base.group_portal,1,0,0,0
access_res_country_public,access.res.country.public,base.model_res_country,base.group_public,1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_country_details_user access.country.details.user model_country_details base.group_user 1 1 1 1
3 access_res_country_user access.res.country.user base.model_res_country base.group_portal 1 0 0 0
4 access_res_country_public access.res.country.public base.model_res_country base.group_public 1 0 0 0

4
website_restrict_country/views/website_templates.xml

@ -130,8 +130,8 @@
<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['main_button_href']">
<t t-out="step_specific_values['main_button']"/>
t-att-href="step_specific_values.get('main_button_href', '#')">
Checkout
<i class="fa fa-angle-right ms-2 fw-light"/>
</a>
</t>

Loading…
Cancel
Save