-
-
Notifications
You must be signed in to change notification settings - Fork 694
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] website_portal_address: filter state by country
- fix hidden address when choose contact
- Loading branch information
Showing
3 changed files
with
78 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,50 @@ | ||
/* Copyright 2012-Today Serpent Consulting Services PVT. LTD. (http://www.serpentcs.com) | ||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ | ||
odoo.define("website_portal_contact.tour", function (require) { | ||
odoo.define("website_portal_address.website_portal_address", function (require) { | ||
"use strict"; | ||
var ajax = require("web.ajax"); | ||
$(document).ready(function() { | ||
$('input[type="radio"]').click(function() { | ||
if($(this).attr("value") === "contact") { | ||
$(".contact_address_website").addClass('hidden'); | ||
} | ||
else { | ||
$(".contact_address_website").removeClass('hidden'); | ||
$(document).ready(function () { | ||
var first_execution = true; | ||
|
||
$('input[type="radio"]').click(function () { | ||
if ($(this).attr("value") === "contact") { | ||
$(".contact_address_website").hide(); | ||
} else { | ||
$(".contact_address_website").show(); | ||
} | ||
}); | ||
$('input[type="radio"]').each(function() { | ||
if($(this).attr('checked') === 'checked') { | ||
|
||
$('input[type="radio"]').each(function () { | ||
if ($(this).attr('checked') === 'checked') { | ||
$(this).click(); | ||
} | ||
}); | ||
|
||
$('#country_id').change(function () { | ||
var option_count = 0; | ||
$("#state_id option").each(function () { | ||
var country_id = parseInt($('#country_id').val()); | ||
var state_country_id = parseInt($(this).val().split("-", 1)); | ||
if (country_id == state_country_id) { | ||
option_count++; | ||
$(this).removeAttr("disabled").show(); | ||
} else { | ||
$(this).attr("disabled", "disabled").hide(); | ||
} | ||
}); | ||
// Ignore first execution, it's override t-att-selected | ||
if (first_execution) { | ||
first_execution = false; | ||
} else { | ||
$("#state_id").val($("#state_id option:first").val()); | ||
} | ||
// Hide state part if empty | ||
if (option_count > 0) { | ||
$('#state_id').parent().show(); | ||
} else { | ||
$('#state_id').parent().hide(); | ||
} | ||
}).change(); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters