fix(Holiday List): allow empty value

This commit is contained in:
barredterra 2023-07-14 12:33:27 +02:00
parent 8271a39cdb
commit 8aff5a1dab
3 changed files with 11 additions and 8 deletions

View File

@ -9,11 +9,10 @@ frappe.ui.form.on("Holiday List", {
frm.call("get_supported_countries").then(r => {
frm.subdivisions_by_country = r.message.subdivisions_by_country;
frm.set_df_property(
"country",
"options",
r.message.countries.sort((a, b) => a.label.localeCompare(b.label))
);
const countries = r.message.countries.sort((a, b) => a.label.localeCompare(b.label));
countries.unshift({ value: "", label: __("Select Country ...") });
frm.set_df_property("country", "options", countries);
if (frm.doc.country) {
frm.trigger("set_subdivisions");
@ -34,9 +33,10 @@ frappe.ui.form.on("Holiday List", {
}
},
set_subdivisions: function(frm) {
const subdivisions = frm.subdivisions_by_country[frm.doc.country];
const subdivisions = [...frm.subdivisions_by_country[frm.doc.country]];
if (subdivisions && subdivisions.length > 0) {
frm.set_df_property("subdivision", "options", frm.subdivisions_by_country[frm.doc.country]);
subdivisions.unshift({ value: "", label: __("Select Subdivision ...") });
frm.set_df_property("subdivision", "options", subdivisions);
frm.set_df_property("subdivision", "hidden", 0);
} else {
frm.set_df_property("subdivision", "options", "");

View File

@ -53,7 +53,7 @@ class HolidayList(Document):
@frappe.whitelist()
def get_local_holidays(self):
if not self.country:
throw(_("Please select Country"))
throw(_("Please select a country"))
existing_holidays = self.get_holidays()
from_date = getdate(self.from_date)

View File

@ -4004,6 +4004,8 @@ Search for a payment,Suche nach einer Zahlung,
Search for anything ...,Nach etwas suchen ...,
Search results for,Suchergebnisse für,
Select All,Alles auswählen,
Select Country ...,Land auswählen ...,
Select Subdivision ...,Teilgebiet auswählen ...,
Select Difference Account,Wählen Sie Differenzkonto,
Select a Default Priority.,Wählen Sie eine Standardpriorität.,
Select a company,Wählen Sie eine Firma aus,
@ -4194,6 +4196,7 @@ Mode Of Payment,Zahlungsart,
No students Found,Keine Schüler gefunden,
Not in Stock,Nicht lagernd,
Please select a Customer,Bitte wählen Sie einen Kunden aus,
Please select a country,Bitte wählen Sie ein Land aus,
Printed On,Gedruckt auf,
Received From,Erhalten von,
Sales Person,Verkäufer,

Can't render this file because it is too large.