feat: Add 'ABBR' variable to support company abbreviation in naming series (#43260)

* Add ABBR variable in naming settings

* Add ABBR variable in naming settings

* Update utils.py

* chore: resolve linter

---------

Co-authored-by: ruthra kumar <ruthra@erpnext.com>
This commit is contained in:
Khaled Bin Amir
2024-11-19 15:45:27 +06:00
committed by GitHub
parent b3c558f0c0
commit a2199db5e5
2 changed files with 9 additions and 0 deletions

View File

@@ -1367,6 +1367,14 @@ def parse_naming_series_variable(doc, variable):
company = None company = None
return get_fiscal_year(date=date, company=company)[0] 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() @frappe.whitelist()
def get_coa(doctype, parent, is_root=None, chart=None): def get_coa(doctype, parent, is_root=None, chart=None):

View File

@@ -393,6 +393,7 @@ doc_events = {
# function should expect the variable and doc as arguments # function should expect the variable and doc as arguments
naming_series_variables = { naming_series_variables = {
"FY": "erpnext.accounts.utils.parse_naming_series_variable", "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. # On cancel event Payment Entry will be exempted and all linked submittable doctype will get cancelled.