Merge pull request #36412 from pancho-s/Custom_Abbr_On_Setup
feat: Reallow customizing company abbreviation on setup.
This commit is contained in:
commit
10529e1f5a
@ -24,12 +24,14 @@ erpnext.setup.slides_settings = [
|
||||
fieldtype: 'Data',
|
||||
reqd: 1
|
||||
},
|
||||
{ fieldtype: "Column Break" },
|
||||
{
|
||||
fieldname: 'company_abbr',
|
||||
label: __('Company Abbreviation'),
|
||||
fieldtype: 'Data',
|
||||
hidden: 1
|
||||
reqd: 1
|
||||
},
|
||||
{ fieldtype: "Section Break" },
|
||||
{
|
||||
fieldname: 'chart_of_accounts', label: __('Chart of Accounts'),
|
||||
options: "", fieldtype: 'Select'
|
||||
@ -134,18 +136,20 @@ erpnext.setup.slides_settings = [
|
||||
me.charts_modal(slide, chart_template);
|
||||
});
|
||||
|
||||
slide.get_input("company_name").on("change", function () {
|
||||
slide.get_input("company_name").on("input", function () {
|
||||
let parts = slide.get_input("company_name").val().split(" ");
|
||||
let abbr = $.map(parts, function (p) { return p ? p.substr(0, 1) : null }).join("");
|
||||
slide.get_field("company_abbr").set_value(abbr.slice(0, 10).toUpperCase());
|
||||
}).val(frappe.boot.sysdefaults.company_name || "").trigger("change");
|
||||
|
||||
slide.get_input("company_abbr").on("change", function () {
|
||||
if (slide.get_input("company_abbr").val().length > 10) {
|
||||
let abbr = slide.get_input("company_abbr").val();
|
||||
if (abbr.length > 10) {
|
||||
frappe.msgprint(__("Company Abbreviation cannot have more than 5 characters"));
|
||||
slide.get_field("company_abbr").set_value("");
|
||||
abbr = abbr.slice(0, 10);
|
||||
}
|
||||
});
|
||||
slide.get_field("company_abbr").set_value(abbr);
|
||||
}).val(frappe.boot.sysdefaults.company_abbr || "").trigger("change");
|
||||
},
|
||||
|
||||
charts_modal: function(slide, chart_template) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user