fix: Default year start and end dates in reports
This commit is contained in:
parent
781e57f5bf
commit
3c92686f0a
@ -79,8 +79,8 @@ frappe.ui.form.on('Account', {
|
||||
frm.add_custom_button(__('General Ledger'), function () {
|
||||
frappe.route_options = {
|
||||
"account": frm.doc.name,
|
||||
"from_date": frappe.sys_defaults.year_start_date,
|
||||
"to_date": frappe.sys_defaults.year_end_date,
|
||||
"from_date": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
"to_date": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
"company": frm.doc.company
|
||||
};
|
||||
frappe.set_route("query-report", "General Ledger");
|
||||
|
@ -194,8 +194,8 @@ frappe.treeview_settings["Account"] = {
|
||||
click: function(node, btn) {
|
||||
frappe.route_options = {
|
||||
"account": node.label,
|
||||
"from_date": frappe.sys_defaults.year_start_date,
|
||||
"to_date": frappe.sys_defaults.year_end_date,
|
||||
"from_date": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
"to_date": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
"company": frappe.treeview_settings['Account'].treeview.page.fields_dict.company.get_value()
|
||||
};
|
||||
frappe.set_route("query-report", "General Ledger");
|
||||
|
@ -15,14 +15,14 @@ frappe.query_reports["Asset Depreciations and Balances"] = {
|
||||
"fieldname":"from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_start_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
@ -7,7 +7,7 @@ frappe.query_reports["Bank Clearance Summary"] = {
|
||||
"fieldname":"from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_start_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
"width": "80"
|
||||
},
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ frappe.query_reports["Budget Variance Report"] = {
|
||||
label: __("From Fiscal Year"),
|
||||
fieldtype: "Link",
|
||||
options: "Fiscal Year",
|
||||
default: frappe.sys_defaults.fiscal_year,
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
||||
reqd: 1
|
||||
},
|
||||
{
|
||||
@ -16,7 +16,7 @@ frappe.query_reports["Budget Variance Report"] = {
|
||||
label: __("To Fiscal Year"),
|
||||
fieldtype: "Link",
|
||||
options: "Fiscal Year",
|
||||
default: frappe.sys_defaults.fiscal_year,
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
||||
reqd: 1
|
||||
},
|
||||
{
|
||||
|
@ -38,14 +38,14 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
||||
"fieldname": "from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_start_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
@ -15,14 +15,14 @@ frappe.query_reports["Gross Profit"] = {
|
||||
"fieldname": "from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_start_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ frappe.query_reports["Payment Period Based On Invoice Date"] = {
|
||||
fieldname: "from_date",
|
||||
label: __("From Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_user_default("year_start_date"),
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
},
|
||||
{
|
||||
fieldname:"to_date",
|
||||
|
@ -45,13 +45,13 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
||||
"fieldname": "from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_start_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
},
|
||||
{
|
||||
"fieldname": "to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
},
|
||||
{
|
||||
"fieldname": "show_zero_values",
|
||||
|
@ -37,13 +37,13 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
||||
"fieldname": "from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_start_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
},
|
||||
{
|
||||
"fieldname": "to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
},
|
||||
{
|
||||
"fieldname": "cost_center",
|
||||
|
@ -36,13 +36,13 @@ frappe.query_reports["Trial Balance for Party"] = {
|
||||
"fieldname": "from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_start_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
},
|
||||
{
|
||||
"fieldname": "to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
},
|
||||
{
|
||||
"fieldname":"party_type",
|
||||
|
@ -27,13 +27,13 @@ frappe.query_reports["Procurement Tracker"] = {
|
||||
fieldname: "from_date",
|
||||
label: __("From Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_user_default("year_start_date"),
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
},
|
||||
{
|
||||
fieldname:"to_date",
|
||||
label: __("To Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_user_default("year_end_date"),
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@ -35,14 +35,14 @@ frappe.query_reports["Purchase Analytics"] = {
|
||||
fieldname: "from_date",
|
||||
label: __("From Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_user_default("year_start_date"),
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
reqd: 1
|
||||
},
|
||||
{
|
||||
fieldname:"to_date",
|
||||
label: __("To Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_user_default("year_end_date"),
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
reqd: 1
|
||||
},
|
||||
{
|
||||
|
@ -6,13 +6,13 @@ frappe.query_reports["Campaign Efficiency"] = {
|
||||
"fieldname": "from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_start_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
},
|
||||
{
|
||||
"fieldname": "to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
}
|
||||
]
|
||||
};
|
||||
|
@ -6,12 +6,12 @@
|
||||
"fieldname": "from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_start_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
},
|
||||
{
|
||||
"fieldname": "to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
}
|
||||
]};
|
||||
|
@ -37,14 +37,14 @@ frappe.query_reports["Job Card Summary"] = {
|
||||
label: __("From Posting Date"),
|
||||
fieldname:"from_date",
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_user_default("year_start_date"),
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
reqd: 1
|
||||
},
|
||||
{
|
||||
label: __("To Posting Date"),
|
||||
fieldname:"to_date",
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_user_default("year_end_date"),
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
reqd: 1,
|
||||
},
|
||||
{
|
||||
|
@ -16,14 +16,14 @@ frappe.query_reports["Production Analytics"] = {
|
||||
fieldname: "from_date",
|
||||
label: __("From Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_user_default("year_start_date"),
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
reqd: 1
|
||||
},
|
||||
{
|
||||
fieldname:"to_date",
|
||||
label: __("To Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_user_default("year_end_date"),
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
reqd: 1
|
||||
},
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ erpnext.get_purchase_trends_filters = function() {
|
||||
"label": __("Fiscal Year"),
|
||||
"fieldtype": "Link",
|
||||
"options":'Fiscal Year',
|
||||
"default": frappe.sys_defaults.fiscal_year
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today())
|
||||
},
|
||||
{
|
||||
"fieldname":"period_based_on",
|
||||
|
@ -48,7 +48,7 @@ erpnext.get_sales_trends_filters = function() {
|
||||
"label": __("Fiscal Year"),
|
||||
"fieldtype": "Link",
|
||||
"options":'Fiscal Year',
|
||||
"default": frappe.sys_defaults.fiscal_year
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
||||
},
|
||||
{
|
||||
"fieldname":"company",
|
||||
|
@ -400,7 +400,7 @@ $.extend(erpnext.utils, {
|
||||
});
|
||||
},
|
||||
|
||||
get_fiscal_year: function(date) {
|
||||
get_fiscal_year: function(date, with_dates) {
|
||||
if(!date) {
|
||||
date = frappe.datetime.get_today();
|
||||
}
|
||||
@ -414,7 +414,10 @@ $.extend(erpnext.utils, {
|
||||
async: false,
|
||||
callback: function(r) {
|
||||
if (r.message) {
|
||||
fiscal_year = r.message[0];
|
||||
if (with_dates)
|
||||
fiscal_year = r.message;
|
||||
else
|
||||
fiscal_year = r.message[0];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -23,14 +23,14 @@ frappe.query_reports["Customer Acquisition and Loyalty"] = {
|
||||
"fieldname":"from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_start_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.defaults.get_user_default("year_end_date"),
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
|
@ -35,14 +35,14 @@ frappe.query_reports["Sales Analytics"] = {
|
||||
fieldname: "from_date",
|
||||
label: __("From Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_user_default("year_start_date"),
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
reqd: 1
|
||||
},
|
||||
{
|
||||
fieldname:"to_date",
|
||||
label: __("To Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_user_default("year_end_date"),
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
reqd: 1
|
||||
},
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ frappe.query_reports["Sales Partner Target Variance based on Item Group"] = {
|
||||
label: __("Fiscal Year"),
|
||||
fieldtype: "Link",
|
||||
options: "Fiscal Year",
|
||||
default: frappe.sys_defaults.fiscal_year
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today())
|
||||
},
|
||||
{
|
||||
fieldname: "doctype",
|
||||
|
@ -22,7 +22,7 @@ frappe.query_reports["Sales Person Commission Summary"] = {
|
||||
fieldname: "from_date",
|
||||
label: __("From Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_user_default("year_start_date"),
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
},
|
||||
{
|
||||
fieldname:"to_date",
|
||||
|
@ -16,7 +16,7 @@ frappe.query_reports["Sales Person Target Variance Based On Item Group"] = {
|
||||
label: __("Fiscal Year"),
|
||||
fieldtype: "Link",
|
||||
options: "Fiscal Year",
|
||||
default: frappe.sys_defaults.fiscal_year
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
||||
},
|
||||
{
|
||||
fieldname: "doctype",
|
||||
|
@ -20,7 +20,7 @@ frappe.query_reports["Sales Person-wise Transaction Summary"] = {
|
||||
fieldname: "from_date",
|
||||
label: __("From Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_user_default("year_start_date"),
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
},
|
||||
{
|
||||
fieldname:"to_date",
|
||||
|
@ -16,7 +16,7 @@ frappe.query_reports["Territory Target Variance Based On Item Group"] = {
|
||||
label: __("Fiscal Year"),
|
||||
fieldtype: "Link",
|
||||
options: "Fiscal Year",
|
||||
default: frappe.sys_defaults.fiscal_year
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today())
|
||||
},
|
||||
{
|
||||
fieldname: "doctype",
|
||||
|
@ -8,7 +8,7 @@ frappe.query_reports["Batch Item Expiry Status"] = {
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"width": "80",
|
||||
"default": frappe.sys_defaults.year_start_date,
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
"reqd": 1,
|
||||
},
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ frappe.query_reports["Batch-Wise Balance History"] = {
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"width": "80",
|
||||
"default": frappe.sys_defaults.year_start_date,
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
|
@ -22,14 +22,14 @@ frappe.query_reports["Incorrect Serial No Valuation"] = {
|
||||
fieldtype: 'Date',
|
||||
fieldname: 'from_date',
|
||||
reqd: 1,
|
||||
default: frappe.defaults.get_user_default("year_start_date")
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
},
|
||||
{
|
||||
label: __('To Date'),
|
||||
fieldtype: 'Date',
|
||||
fieldname: 'to_date',
|
||||
reqd: 1,
|
||||
default: frappe.defaults.get_user_default("year_end_date")
|
||||
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
|
||||
}
|
||||
]
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ frappe.query_reports["Itemwise Recommended Reorder Level"] = {
|
||||
"fieldname":"from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.sys_defaults.year_start_date
|
||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
|
||||
},
|
||||
{
|
||||
"fieldname":"to_date",
|
||||
|
Loading…
Reference in New Issue
Block a user