diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 13f59095534..34951afa751 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -1367,6 +1367,14 @@ def parse_naming_series_variable(doc, variable): company = None return get_fiscal_year(date=date, company=company)[0] + elif variable == "ABBR": + if doc: + company = doc.get("company") or frappe.db.get_default("company") + else: + company = frappe.db.get_default("company") + + return frappe.db.get_value("Company", company, "abbr") if company else "" + @frappe.whitelist() def get_coa(doctype, parent, is_root=None, chart=None): diff --git a/erpnext/hooks.py b/erpnext/hooks.py index ca7f7280943..63d0a0785c4 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -393,6 +393,7 @@ doc_events = { # function should expect the variable and doc as arguments naming_series_variables = { "FY": "erpnext.accounts.utils.parse_naming_series_variable", + "ABBR": "erpnext.accounts.utils.parse_naming_series_variable", } # On cancel event Payment Entry will be exempted and all linked submittable doctype will get cancelled.