fix: Remove current fiscal year from Global Defaults (#35960)
* fix: Remove current fiscal year from Global Defaults
* fix: Remove button to set default
* fix: Add utils to get fiscal year
* fix: Incorrect import
* feat: Add hook for naming series parser
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.js b/erpnext/accounts/doctype/fiscal_year/fiscal_year.js
index bc77dac..508b2ea 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.js
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.js
@@ -8,17 +8,6 @@
frappe.datetime.add_days(frappe.defaults.get_default("year_end_date"), 1));
}
},
- refresh: function (frm) {
- if (!frm.doc.__islocal && (frm.doc.name != frappe.sys_defaults.fiscal_year)) {
- frm.add_custom_button(__("Set as Default"), () => frm.events.set_as_default(frm));
- frm.set_intro(__("To set this Fiscal Year as Default, click on 'Set as Default'"));
- } else {
- frm.set_intro("");
- }
- },
- set_as_default: function(frm) {
- return frm.call('set_as_default');
- },
year_start_date: function(frm) {
if (!frm.doc.is_short_year) {
let year_end_date =
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
index 9d1b99b..0dfe569 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
@@ -4,28 +4,12 @@
import frappe
from dateutil.relativedelta import relativedelta
-from frappe import _, msgprint
+from frappe import _
from frappe.model.document import Document
from frappe.utils import add_days, add_years, cstr, getdate
class FiscalYear(Document):
- @frappe.whitelist()
- def set_as_default(self):
- frappe.db.set_single_value("Global Defaults", "current_fiscal_year", self.name)
- global_defaults = frappe.get_doc("Global Defaults")
- global_defaults.check_permission("write")
- global_defaults.on_update()
-
- # clear cache
- frappe.clear_cache()
-
- msgprint(
- _(
- "{0} is now the default Fiscal Year. Please refresh your browser for the change to take effect."
- ).format(self.name)
- )
-
def validate(self):
self.validate_dates()
self.validate_overlap()
@@ -68,13 +52,6 @@
frappe.cache().delete_value("fiscal_years")
def on_trash(self):
- global_defaults = frappe.get_doc("Global Defaults")
- if global_defaults.current_fiscal_year == self.name:
- frappe.throw(
- _(
- "You cannot delete Fiscal Year {0}. Fiscal Year {0} is set as default in Global Settings"
- ).format(self.name)
- )
frappe.cache().delete_value("fiscal_years")
def validate_overlap(self):
diff --git a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.js b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.js
index dd965a9..d58fd95 100644
--- a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.js
+++ b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.js
@@ -49,7 +49,7 @@
"label": __("Start Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"reqd": 1,
on_change: () => {
frappe.model.with_doc("Fiscal Year", frappe.query_report.get_filter_value('from_fiscal_year'), function(r) {
@@ -65,7 +65,7 @@
"label": __("End Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"reqd": 1,
on_change: () => {
frappe.model.with_doc("Fiscal Year", frappe.query_report.get_filter_value('to_fiscal_year'), function(r) {
@@ -139,7 +139,7 @@
return value;
},
onload: function() {
- let fiscal_year = frappe.defaults.get_user_default("fiscal_year")
+ let fiscal_year = erpnext.utils.get_fiscal_year(frappe.datetime.get_today());
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
diff --git a/erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.js b/erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.js
index 0056b9e..96e0c84 100644
--- a/erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.js
+++ b/erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.js
@@ -48,7 +48,7 @@
"label": __("Start Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"reqd": 1
},
{
@@ -56,7 +56,7 @@
"label": __("End Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"reqd": 1
},
{
@@ -100,7 +100,7 @@
return default_formatter(value, row, column, data);
},
onload: function(report){
- let fiscal_year = frappe.defaults.get_user_default("fiscal_year");
+ let fiscal_year = erpnext.utils.get_fiscal_year(frappe.datetime.get_today());
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
diff --git a/erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.py b/erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.py
index 3e11643..cad5325 100644
--- a/erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.py
+++ b/erpnext/accounts/report/deferred_revenue_and_expense/deferred_revenue_and_expense.py
@@ -4,9 +4,10 @@
import frappe
from frappe import _, qb
from frappe.query_builder import Column, functions
-from frappe.utils import add_days, date_diff, flt, get_first_day, get_last_day, rounded
+from frappe.utils import add_days, date_diff, flt, get_first_day, get_last_day, getdate, rounded
from erpnext.accounts.report.financial_statements import get_period_list
+from erpnext.accounts.utils import get_fiscal_year
class Deferred_Item(object):
@@ -226,7 +227,7 @@
# If no filters are provided, get user defaults
if not filters:
- fiscal_year = frappe.get_doc("Fiscal Year", frappe.defaults.get_user_default("fiscal_year"))
+ fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date=getdate()))
self.filters = frappe._dict(
{
"company": frappe.defaults.get_user_default("Company"),
diff --git a/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py b/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py
index 023ff22..c84b843 100644
--- a/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py
+++ b/erpnext/accounts/report/deferred_revenue_and_expense/test_deferred_revenue_and_expense.py
@@ -10,6 +10,7 @@
from erpnext.accounts.report.deferred_revenue_and_expense.deferred_revenue_and_expense import (
Deferred_Revenue_and_Expense_Report,
)
+from erpnext.accounts.utils import get_fiscal_year
from erpnext.buying.doctype.supplier.test_supplier import create_supplier
from erpnext.stock.doctype.item.test_item import create_item
@@ -116,7 +117,7 @@
pda.submit()
# execute report
- fiscal_year = frappe.get_doc("Fiscal Year", frappe.defaults.get_user_default("fiscal_year"))
+ fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date="2021-05-01"))
self.filters = frappe._dict(
{
"company": frappe.defaults.get_user_default("Company"),
@@ -209,7 +210,7 @@
pda.submit()
# execute report
- fiscal_year = frappe.get_doc("Fiscal Year", frappe.defaults.get_user_default("fiscal_year"))
+ fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date="2021-05-01"))
self.filters = frappe._dict(
{
"company": frappe.defaults.get_user_default("Company"),
@@ -297,7 +298,7 @@
pda.submit()
# execute report
- fiscal_year = frappe.get_doc("Fiscal Year", frappe.defaults.get_user_default("fiscal_year"))
+ fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date="2021-05-01"))
self.filters = frappe._dict(
{
"company": frappe.defaults.get_user_default("Company"),
diff --git a/erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.js b/erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.js
index ea05a35..9d416db 100644
--- a/erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.js
+++ b/erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.js
@@ -18,7 +18,7 @@
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"reqd": 1,
"on_change": function(query_report) {
var fiscal_year = query_report.get_values().fiscal_year;
diff --git a/erpnext/accounts/report/profitability_analysis/profitability_analysis.js b/erpnext/accounts/report/profitability_analysis/profitability_analysis.js
index 889ede5..6caebd3 100644
--- a/erpnext/accounts/report/profitability_analysis/profitability_analysis.js
+++ b/erpnext/accounts/report/profitability_analysis/profitability_analysis.js
@@ -25,7 +25,7 @@
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"reqd": 1,
"on_change": function(query_report) {
var fiscal_year = query_report.get_values().fiscal_year;
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.js b/erpnext/accounts/report/trial_balance/trial_balance.js
index 078b065..e45c3ad 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.js
+++ b/erpnext/accounts/report/trial_balance/trial_balance.js
@@ -17,7 +17,7 @@
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"reqd": 1,
"on_change": function(query_report) {
var fiscal_year = query_report.get_values().fiscal_year;
diff --git a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js
index 0e93035..0f7578c 100644
--- a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js
+++ b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js
@@ -16,7 +16,7 @@
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"reqd": 1,
"on_change": function(query_report) {
var fiscal_year = query_report.get_values().fiscal_year;
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 8b44b22..4b54483 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -1110,6 +1110,11 @@
return " - ".join(parts)
+def parse_naming_series_variable(doc, variable):
+ if variable == "FY":
+ return get_fiscal_year(date=doc.get("posting_date"), company=doc.get("company"))[0]
+
+
@frappe.whitelist()
def get_coa(doctype, parent, is_root, chart=None):
from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import (
diff --git a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.js b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.js
index b788a32..48b17f5 100644
--- a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.js
+++ b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.js
@@ -82,7 +82,7 @@
"label": __("Start Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"depends_on": "eval: doc.filter_based_on == 'Fiscal Year'",
},
{
@@ -90,7 +90,7 @@
"label": __("End Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"depends_on": "eval: doc.filter_based_on == 'Fiscal Year'",
},
{
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 28d79d1..66f3de4 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -354,6 +354,11 @@
},
}
+# function should expect the variable and doc as arguments
+naming_series_variables = {
+ "FY": "erpnext.accounts.utils.parse_naming_series_variable",
+}
+
# On cancel event Payment Entry will be exempted and all linked submittable doctype will get cancelled.
# to maintain data integrity we exempted payment entry. it will un-link when sales invoice get cancelled.
# if payment entry not in auto cancel exempted doctypes it will cancel payment entry.
diff --git a/erpnext/manufacturing/report/job_card_summary/job_card_summary.js b/erpnext/manufacturing/report/job_card_summary/job_card_summary.js
index 782ce81..a874f22 100644
--- a/erpnext/manufacturing/report/job_card_summary/job_card_summary.js
+++ b/erpnext/manufacturing/report/job_card_summary/job_card_summary.js
@@ -17,7 +17,7 @@
label: __("Fiscal Year"),
fieldtype: "Link",
options: "Fiscal Year",
- default: frappe.defaults.get_user_default("fiscal_year"),
+ default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
reqd: 1,
on_change: function(query_report) {
var fiscal_year = query_report.get_values().fiscal_year;
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 6fa4b5a..73e0a95 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -334,4 +334,5 @@
erpnext.patches.v15_0.remove_loan_management_module #2023-07-03
erpnext.patches.v14_0.set_report_in_process_SOA
erpnext.buying.doctype.supplier.patches.migrate_supplier_portal_users
+execute:frappe.defaults.clear_default("fiscal_year")
erpnext.patches.v15_0.remove_exotel_integration
diff --git a/erpnext/public/js/financial_statements.js b/erpnext/public/js/financial_statements.js
index 2b50a75..959cf50 100644
--- a/erpnext/public/js/financial_statements.js
+++ b/erpnext/public/js/financial_statements.js
@@ -56,7 +56,7 @@
// dropdown for links to other financial statements
erpnext.financial_statements.filters = get_filters()
- let fiscal_year = frappe.defaults.get_user_default("fiscal_year")
+ let fiscal_year = erpnext.utils.get_fiscal_year(frappe.datetime.get_today());
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
@@ -137,7 +137,7 @@
"label": __("Start Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"reqd": 1,
"depends_on": "eval:doc.filter_based_on == 'Fiscal Year'"
},
@@ -146,7 +146,7 @@
"label": __("End Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"reqd": 1,
"depends_on": "eval:doc.filter_based_on == 'Fiscal Year'"
},
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 13d35f3..8d6097d 100755
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -381,6 +381,23 @@
});
});
});
+ },
+
+ get_fiscal_year: function(date) {
+ let fiscal_year = '';
+ frappe.call({
+ method: "erpnext.accounts.utils.get_fiscal_year",
+ args: {
+ date: date
+ },
+ async: false,
+ callback: function(r) {
+ if (r.message) {
+ fiscal_year = r.message[0];
+ }
+ }
+ });
+ return fiscal_year;
}
});
diff --git "a/erpnext/regional/report/fichier_des_ecritures_comptables_\133fec\135/fichier_des_ecritures_comptables_\133fec\135.js" "b/erpnext/regional/report/fichier_des_ecritures_comptables_\133fec\135/fichier_des_ecritures_comptables_\133fec\135.js"
index a4c7640..b85b58f 100644
--- "a/erpnext/regional/report/fichier_des_ecritures_comptables_\133fec\135/fichier_des_ecritures_comptables_\133fec\135.js"
+++ "b/erpnext/regional/report/fichier_des_ecritures_comptables_\133fec\135/fichier_des_ecritures_comptables_\133fec\135.js"
@@ -16,7 +16,7 @@
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"reqd": 1
}
],
diff --git a/erpnext/regional/report/irs_1099/irs_1099.js b/erpnext/regional/report/irs_1099/irs_1099.js
index 070ff43..b3508e4 100644
--- a/erpnext/regional/report/irs_1099/irs_1099.js
+++ b/erpnext/regional/report/irs_1099/irs_1099.js
@@ -17,7 +17,7 @@
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
+ "default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
"reqd": 1,
"width": 80,
},
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.json b/erpnext/setup/doctype/global_defaults/global_defaults.json
index bafb97a..823d2ba 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.json
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.json
@@ -1,352 +1,99 @@
{
- "allow_copy": 1,
- "allow_guest_to_view": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "beta": 0,
- "creation": "2013-05-02 17:53:24",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "editable_grid": 0,
+ "actions": [],
+ "allow_copy": 1,
+ "creation": "2013-05-02 17:53:24",
+ "doctype": "DocType",
+ "engine": "InnoDB",
+ "field_order": [
+ "default_company",
+ "country",
+ "default_distance_unit",
+ "column_break_8",
+ "default_currency",
+ "hide_currency_symbol",
+ "disable_rounded_total",
+ "disable_in_words"
+ ],
"fields": [
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "default_company",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 1,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Default Company",
- "length": 0,
- "no_copy": 0,
- "options": "Company",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "default_company",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Company",
+ "options": "Company"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "current_fiscal_year",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Current Fiscal Year",
- "length": 0,
- "no_copy": 0,
- "options": "Fiscal Year",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 1,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "country",
+ "fieldtype": "Link",
+ "label": "Country",
+ "options": "Country"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "country",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Country",
- "length": 0,
- "no_copy": 0,
- "options": "Country",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "default_distance_unit",
+ "fieldtype": "Link",
+ "label": "Default Distance Unit",
+ "options": "UOM"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "default": "",
- "fieldname": "default_distance_unit",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Default Distance Unit",
- "length": 0,
- "no_copy": 0,
- "options": "UOM",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "column_break_8",
+ "fieldtype": "Column Break"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "column_break_8",
- "fieldtype": "Column Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "default": "INR",
+ "fieldname": "default_currency",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "in_list_view": 1,
+ "label": "Default Currency",
+ "options": "Currency",
+ "reqd": 1
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "default": "INR",
- "fieldname": "default_currency",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 1,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Default Currency",
- "length": 0,
- "no_copy": 0,
- "options": "Currency",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 1,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "description": "Do not show any symbol like $ etc next to currencies.",
+ "fieldname": "hide_currency_symbol",
+ "fieldtype": "Select",
+ "in_list_view": 1,
+ "label": "Hide Currency Symbol",
+ "options": "\nNo\nYes"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "description": "Do not show any symbol like $ etc next to currencies.",
- "fieldname": "hide_currency_symbol",
- "fieldtype": "Select",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Hide Currency Symbol",
- "length": 0,
- "no_copy": 0,
- "options": "\nNo\nYes",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "default": "0",
+ "description": "If disable, 'Rounded Total' field will not be visible in any transaction",
+ "fieldname": "disable_rounded_total",
+ "fieldtype": "Check",
+ "in_list_view": 1,
+ "label": "Disable Rounded Total"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "description": "If disable, 'Rounded Total' field will not be visible in any transaction",
- "fieldname": "disable_rounded_total",
- "fieldtype": "Check",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Disable Rounded Total",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "description": "If disable, 'In Words' field will not be visible in any transaction",
- "fieldname": "disable_in_words",
- "fieldtype": "Check",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Disable In Words",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
+ "default": "0",
+ "description": "If disable, 'In Words' field will not be visible in any transaction",
+ "fieldname": "disable_in_words",
+ "fieldtype": "Check",
+ "in_list_view": 1,
+ "label": "Disable In Words"
}
- ],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 0,
- "icon": "fa fa-cog",
- "idx": 1,
- "image_view": 0,
- "in_create": 1,
- "is_submittable": 0,
- "issingle": 1,
- "istable": 0,
- "max_attachments": 0,
- "menu_index": 0,
- "modified": "2018-10-15 03:08:19.886212",
- "modified_by": "Administrator",
- "module": "Setup",
- "name": "Global Defaults",
- "owner": "Administrator",
+ ],
+ "icon": "fa fa-cog",
+ "idx": 1,
+ "in_create": 1,
+ "issingle": 1,
+ "links": [],
+ "modified": "2023-07-01 19:45:00.323953",
+ "modified_by": "Administrator",
+ "module": "Setup",
+ "name": "Global Defaults",
+ "owner": "Administrator",
"permissions": [
{
- "amend": 0,
- "cancel": 0,
- "create": 1,
- "delete": 0,
- "email": 0,
- "export": 0,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
- "print": 0,
- "read": 1,
- "report": 0,
- "role": "System Manager",
- "set_user_permissions": 0,
- "share": 1,
- "submit": 0,
+ "create": 1,
+ "read": 1,
+ "role": "System Manager",
+ "share": 1,
"write": 1
}
- ],
- "quick_entry": 0,
- "read_only": 1,
- "read_only_onload": 0,
- "show_name_in_global_search": 0,
- "sort_order": "DESC",
- "track_changes": 0,
- "track_seen": 0,
- "track_views": 0
+ ],
+ "read_only": 1,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": []
}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.py b/erpnext/setup/doctype/global_defaults/global_defaults.py
index 16e9434..fc80483 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.py
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.py
@@ -10,7 +10,6 @@
keydict = {
# "key in defaults": "key in Global Defaults"
- "fiscal_year": "current_fiscal_year",
"company": "default_company",
"currency": "default_currency",
"country": "country",
@@ -29,22 +28,6 @@
for key in keydict:
frappe.db.set_default(key, self.get(keydict[key], ""))
- # update year start date and year end date from fiscal_year
- if self.current_fiscal_year:
- if fiscal_year := frappe.get_all(
- "Fiscal Year",
- filters={"name": self.current_fiscal_year},
- fields=["year_start_date", "year_end_date"],
- limit=1,
- order_by=None,
- ):
- ysd = fiscal_year[0].year_start_date or ""
- yed = fiscal_year[0].year_end_date or ""
-
- if ysd and yed:
- frappe.db.set_default("year_start_date", ysd.strftime("%Y-%m-%d"))
- frappe.db.set_default("year_end_date", yed.strftime("%Y-%m-%d"))
-
# enable default currency
if self.default_currency:
frappe.db.set_value("Currency", self.default_currency, "enabled", 1)
diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py
index 8e61fe2..535c87d 100644
--- a/erpnext/setup/setup_wizard/operations/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py
@@ -462,11 +462,9 @@
def set_global_defaults(args):
global_defaults = frappe.get_doc("Global Defaults", "Global Defaults")
- current_fiscal_year = frappe.get_all("Fiscal Year")[0]
global_defaults.update(
{
- "current_fiscal_year": current_fiscal_year.name,
"default_currency": args.get("currency"),
"default_company": args.get("company_name"),
"country": args.get("country"),