fix: Default year start and end dates in reports

(cherry picked from commit 4496a6760e)

# Conflicts:
#	erpnext/accounts/doctype/account/account.js
#	erpnext/accounts/doctype/account/account_tree.js
#	erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.js
#	erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js
#	erpnext/accounts/report/budget_variance_report/budget_variance_report.js
#	erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.js
#	erpnext/accounts/report/gross_profit/gross_profit.js
#	erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js
#	erpnext/accounts/report/profitability_analysis/profitability_analysis.js
#	erpnext/accounts/report/trial_balance/trial_balance.js
#	erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.js
#	erpnext/buying/report/procurement_tracker/procurement_tracker.js
#	erpnext/buying/report/purchase_analytics/purchase_analytics.js
#	erpnext/crm/report/campaign_efficiency/campaign_efficiency.js
#	erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.js
#	erpnext/manufacturing/report/job_card_summary/job_card_summary.js
#	erpnext/manufacturing/report/production_analytics/production_analytics.js
#	erpnext/public/js/purchase_trends_filters.js
#	erpnext/public/js/sales_trends_filters.js
#	erpnext/public/js/utils.js
#	erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js
#	erpnext/selling/report/sales_analytics/sales_analytics.js
#	erpnext/selling/report/sales_partner_target_variance_based_on_item_group/sales_partner_target_variance_based_on_item_group.js
#	erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.js
#	erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js
#	erpnext/selling/report/territory_target_variance_based_on_item_group/territory_target_variance_based_on_item_group.js
#	erpnext/stock/report/batch_item_expiry_status/batch_item_expiry_status.js
#	erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.js
#	erpnext/stock/report/incorrect_serial_no_valuation/incorrect_serial_no_valuation.js
#	erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js
This commit is contained in:
Deepesh Garg
2023-07-24 11:58:16 +05:30
committed by Mergify
parent 8a45258778
commit 30073698f4
30 changed files with 342 additions and 0 deletions

View File

@@ -103,6 +103,7 @@ frappe.ui.form.on("Account", {
__("View") __("View")
); );
<<<<<<< HEAD
frm.add_custom_button( frm.add_custom_button(
__("Convert to Group"), __("Convert to Group"),
function () { function () {
@@ -116,6 +117,29 @@ frappe.ui.form.on("Account", {
}, },
__("Actions") __("Actions")
); );
=======
} else if (cint(frm.doc.is_group) == 0
&& frappe.boot.user.can_read.indexOf("GL Entry") !== -1) {
frm.add_custom_button(__('General Ledger'), function () {
frappe.route_options = {
"account": frm.doc.name,
"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");
}, __('View'));
frm.add_custom_button(__('Convert to Group'), function () {
return frappe.call({
doc: frm.doc,
method: 'convert_ledger_to_group',
callback: function() {
frm.refresh();
}
});
}, __('Actions'));
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
} }
}, },

View File

@@ -278,11 +278,18 @@ frappe.treeview_settings["Account"] = {
label: __("View Ledger"), label: __("View Ledger"),
click: function (node, btn) { click: function (node, btn) {
frappe.route_options = { frappe.route_options = {
<<<<<<< HEAD
account: node.label, account: node.label,
from_date: frappe.sys_defaults.year_start_date, from_date: frappe.sys_defaults.year_start_date,
to_date: frappe.sys_defaults.year_end_date, to_date: frappe.sys_defaults.year_end_date,
company: company:
frappe.treeview_settings["Account"].treeview.page.fields_dict.company.get_value(), frappe.treeview_settings["Account"].treeview.page.fields_dict.company.get_value(),
=======
"account": node.label,
"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()
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}; };
frappe.set_route("query-report", "General Ledger"); frappe.set_route("query-report", "General Ledger");
}, },

View File

@@ -12,6 +12,7 @@ frappe.query_reports["Asset Depreciations and Balances"] = {
reqd: 1, reqd: 1,
}, },
{ {
<<<<<<< HEAD
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
@@ -24,6 +25,20 @@ frappe.query_reports["Asset Depreciations and Balances"] = {
fieldtype: "Date", fieldtype: "Date",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
reqd: 1, reqd: 1,
=======
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "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": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
"reqd": 1
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "asset_category", fieldname: "asset_category",

View File

@@ -4,11 +4,19 @@
frappe.query_reports["Bank Clearance Summary"] = { frappe.query_reports["Bank Clearance Summary"] = {
filters: [ filters: [
{ {
<<<<<<< HEAD
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
width: "80", width: "80",
=======
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
"width": "80"
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "to_date", fieldname: "to_date",

View File

@@ -44,7 +44,11 @@ function get_filters() {
fieldtype: "Link", fieldtype: "Link",
options: "Fiscal Year", options: "Fiscal Year",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()), default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
<<<<<<< HEAD
reqd: 1, reqd: 1,
=======
reqd: 1
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "to_fiscal_year", fieldname: "to_fiscal_year",
@@ -52,7 +56,11 @@ function get_filters() {
fieldtype: "Link", fieldtype: "Link",
options: "Fiscal Year", options: "Fiscal Year",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()), default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
<<<<<<< HEAD
reqd: 1, reqd: 1,
=======
reqd: 1
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "period", fieldname: "period",

View File

@@ -35,6 +35,7 @@ frappe.require("assets/erpnext/js/financial_statements.js", function () {
}, },
}, },
{ {
<<<<<<< HEAD
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
@@ -47,6 +48,20 @@ frappe.require("assets/erpnext/js/financial_statements.js", function () {
fieldtype: "Date", fieldtype: "Date",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
reqd: 1, reqd: 1,
=======
"fieldname": "from_date",
"label": __("From Date"),
"fieldtype": "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": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
"reqd": 1
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "finance_book", fieldname: "finance_book",

View File

@@ -12,6 +12,7 @@ frappe.query_reports["Gross Profit"] = {
reqd: 1, reqd: 1,
}, },
{ {
<<<<<<< HEAD
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
@@ -24,6 +25,20 @@ frappe.query_reports["Gross Profit"] = {
fieldtype: "Date", fieldtype: "Date",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
reqd: 1, reqd: 1,
=======
"fieldname": "from_date",
"label": __("From Date"),
"fieldtype": "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": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
"reqd": 1
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "sales_invoice", fieldname: "sales_invoice",

View File

@@ -15,7 +15,11 @@ frappe.query_reports["Payment Period Based On Invoice Date"] = {
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "to_date", fieldname: "to_date",

View File

@@ -56,6 +56,7 @@ frappe.require("assets/erpnext/js/financial_statements.js", function () {
}, },
}, },
{ {
<<<<<<< HEAD
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
@@ -66,6 +67,18 @@ frappe.require("assets/erpnext/js/financial_statements.js", function () {
label: __("To Date"), label: __("To Date"),
fieldtype: "Date", fieldtype: "Date",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
=======
"fieldname": "from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
},
{
"fieldname": "to_date",
"label": __("To Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "show_zero_values", fieldname: "show_zero_values",

View File

@@ -34,6 +34,7 @@ frappe.require("assets/erpnext/js/financial_statements.js", function () {
}, },
}, },
{ {
<<<<<<< HEAD
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
@@ -44,6 +45,18 @@ frappe.require("assets/erpnext/js/financial_statements.js", function () {
label: __("To Date"), label: __("To Date"),
fieldtype: "Date", fieldtype: "Date",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
=======
"fieldname": "from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
},
{
"fieldname": "to_date",
"label": __("To Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "cost_center", fieldname: "cost_center",

View File

@@ -33,6 +33,7 @@ frappe.query_reports["Trial Balance for Party"] = {
}, },
}, },
{ {
<<<<<<< HEAD
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
@@ -43,6 +44,18 @@ frappe.query_reports["Trial Balance for Party"] = {
label: __("To Date"), label: __("To Date"),
fieldtype: "Date", fieldtype: "Date",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
=======
"fieldname": "from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
},
{
"fieldname": "to_date",
"label": __("To Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "party_type", fieldname: "party_type",

View File

@@ -27,13 +27,21 @@ frappe.query_reports["Procurement Tracker"] = {
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "to_date", fieldname: "to_date",
label: __("To Date"), label: __("To Date"),
fieldtype: "Date", fieldtype: "Date",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
], ],
}; };

View File

@@ -35,15 +35,25 @@ frappe.query_reports["Purchase Analytics"] = {
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
reqd: 1, reqd: 1,
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
reqd: 1
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "to_date", fieldname: "to_date",
label: __("To Date"), label: __("To Date"),
fieldtype: "Date", fieldtype: "Date",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
reqd: 1, reqd: 1,
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
reqd: 1
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "company", fieldname: "company",

View File

@@ -3,6 +3,7 @@
frappe.query_reports["Campaign Efficiency"] = { frappe.query_reports["Campaign Efficiency"] = {
filters: [ filters: [
{ {
<<<<<<< HEAD
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
@@ -15,4 +16,18 @@ frappe.query_reports["Campaign Efficiency"] = {
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
}, },
], ],
=======
"fieldname": "from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
},
{
"fieldname": "to_date",
"label": __("To Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
}
]
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}; };

View File

@@ -1,5 +1,6 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors // Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt // For license information, please see license.txt
<<<<<<< HEAD
frappe.query_reports["Lead Owner Efficiency"] = { frappe.query_reports["Lead Owner Efficiency"] = {
filters: [ filters: [
{ {
@@ -16,3 +17,20 @@ frappe.query_reports["Lead Owner Efficiency"] = {
}, },
], ],
}; };
=======
frappe.query_reports["Lead Owner Efficiency"] = {
"filters": [
{
"fieldname": "from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
},
{
"fieldname": "to_date",
"label": __("To Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
}
]};
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)

View File

@@ -37,14 +37,23 @@ frappe.query_reports["Job Card Summary"] = {
label: __("From Posting Date"), label: __("From Posting Date"),
fieldname: "from_date", fieldname: "from_date",
fieldtype: "Date", fieldtype: "Date",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
reqd: 1, reqd: 1,
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
reqd: 1
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
label: __("To Posting Date"), label: __("To Posting Date"),
fieldname: "to_date", fieldname: "to_date",
fieldtype: "Date", fieldtype: "Date",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
reqd: 1, reqd: 1,
}, },
{ {

View File

@@ -16,15 +16,25 @@ frappe.query_reports["Production Analytics"] = {
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
reqd: 1, reqd: 1,
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
reqd: 1
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "to_date", fieldname: "to_date",
label: __("To Date"), label: __("To Date"),
fieldtype: "Date", fieldtype: "Date",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
reqd: 1, reqd: 1,
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
reqd: 1
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "range", fieldname: "range",

View File

@@ -24,11 +24,19 @@ erpnext.get_purchase_trends_filters = function () {
default: "Monthly", default: "Monthly",
}, },
{ {
<<<<<<< HEAD
fieldname: "fiscal_year", fieldname: "fiscal_year",
label: __("Fiscal Year"), label: __("Fiscal Year"),
fieldtype: "Link", fieldtype: "Link",
options: "Fiscal Year", options: "Fiscal Year",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()), default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
=======
"fieldname":"fiscal_year",
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options":'Fiscal Year',
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today())
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "period_based_on", fieldname: "period_based_on",

View File

@@ -40,11 +40,19 @@ erpnext.get_sales_trends_filters = function () {
default: "", default: "",
}, },
{ {
<<<<<<< HEAD
fieldname: "fiscal_year", fieldname: "fiscal_year",
label: __("Fiscal Year"), label: __("Fiscal Year"),
fieldtype: "Link", fieldtype: "Link",
options: "Fiscal Year", options: "Fiscal Year",
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()), default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
=======
"fieldname":"fiscal_year",
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options":'Fiscal Year',
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "company", fieldname: "company",

View File

@@ -397,11 +397,48 @@ $.extend(erpnext.utils, {
} }
}, },
<<<<<<< HEAD
get_fiscal_year: function (date, with_dates = false, boolean = false) { get_fiscal_year: function (date, with_dates = false, boolean = false) {
if (!frappe.boot.setup_complete) { if (!frappe.boot.setup_complete) {
return; return;
} }
if (!date) { if (!date) {
=======
pick_serial_and_batch_bundle(frm, cdt, cdn, type_of_transaction, warehouse_field) {
let item_row = frappe.get_doc(cdt, cdn);
item_row.type_of_transaction = type_of_transaction;
frappe.db.get_value("Item", item_row.item_code, ["has_batch_no", "has_serial_no"])
.then((r) => {
item_row.has_batch_no = r.message.has_batch_no;
item_row.has_serial_no = r.message.has_serial_no;
frappe.require("assets/erpnext/js/utils/serial_no_batch_selector.js", function() {
new erpnext.SerialBatchPackageSelector(frm, item_row, (r) => {
if (r) {
let update_values = {
"serial_and_batch_bundle": r.name,
"qty": Math.abs(r.total_qty)
}
if (!warehouse_field) {
warehouse_field = "warehouse";
}
if (r.warehouse) {
update_values[warehouse_field] = r.warehouse;
}
frappe.model.set_value(item_row.doctype, item_row.name, update_values);
}
});
});
});
},
get_fiscal_year: function(date, with_dates) {
if(!date) {
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
date = frappe.datetime.get_today(); date = frappe.datetime.get_today();
} }
@@ -415,8 +452,15 @@ $.extend(erpnext.utils, {
async: false, async: false,
callback: function (r) { callback: function (r) {
if (r.message) { if (r.message) {
<<<<<<< HEAD
if (with_dates) fiscal_year = r.message; if (with_dates) fiscal_year = r.message;
else fiscal_year = r.message[0]; else fiscal_year = r.message[0];
=======
if (with_dates)
fiscal_year = r.message;
else
fiscal_year = r.message[0];
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
} }
}, },
}); });

View File

@@ -20,6 +20,7 @@ frappe.query_reports["Customer Acquisition and Loyalty"] = {
reqd: 1, reqd: 1,
}, },
{ {
<<<<<<< HEAD
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
@@ -33,6 +34,21 @@ frappe.query_reports["Customer Acquisition and Loyalty"] = {
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
reqd: 1, reqd: 1,
}, },
=======
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "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": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
"reqd": 1
}
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
], ],
formatter: function (value, row, column, data, default_formatter) { formatter: function (value, row, column, data, default_formatter) {
value = default_formatter(value, row, column, data); value = default_formatter(value, row, column, data);

View File

@@ -43,15 +43,25 @@ frappe.query_reports["Sales Analytics"] = {
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
reqd: 1, reqd: 1,
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
reqd: 1
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "to_date", fieldname: "to_date",
label: __("To Date"), label: __("To Date"),
fieldtype: "Date", fieldtype: "Date",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
reqd: 1, reqd: 1,
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
reqd: 1
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "company", fieldname: "company",

View File

@@ -16,7 +16,11 @@ frappe.query_reports["Sales Partner Target Variance based on Item Group"] = {
label: __("Fiscal Year"), label: __("Fiscal Year"),
fieldtype: "Link", fieldtype: "Link",
options: "Fiscal Year", options: "Fiscal Year",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()), default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today())
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "doctype", fieldname: "doctype",

View File

@@ -21,7 +21,11 @@ frappe.query_reports["Sales Person Commission Summary"] = {
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "to_date", fieldname: "to_date",

View File

@@ -20,7 +20,11 @@ frappe.query_reports["Sales Person-wise Transaction Summary"] = {
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "to_date", fieldname: "to_date",

View File

@@ -16,7 +16,11 @@ frappe.query_reports["Territory Target Variance Based On Item Group"] = {
label: __("Fiscal Year"), label: __("Fiscal Year"),
fieldtype: "Link", fieldtype: "Link",
options: "Fiscal Year", options: "Fiscal Year",
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()), default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today())
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "doctype", fieldname: "doctype",

View File

@@ -4,12 +4,21 @@
frappe.query_reports["Batch Item Expiry Status"] = { frappe.query_reports["Batch Item Expiry Status"] = {
filters: [ filters: [
{ {
<<<<<<< HEAD
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
width: "80", width: "80",
default: frappe.sys_defaults.year_start_date, default: frappe.sys_defaults.year_start_date,
reqd: 1, reqd: 1,
=======
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "Date",
"width": "80",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
"reqd": 1,
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "to_date", fieldname: "to_date",

View File

@@ -12,12 +12,21 @@ frappe.query_reports["Batch-Wise Balance History"] = {
reqd: 1, reqd: 1,
}, },
{ {
<<<<<<< HEAD
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
width: "80", width: "80",
default: frappe.sys_defaults.year_start_date, default: frappe.sys_defaults.year_start_date,
reqd: 1, reqd: 1,
=======
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "Date",
"width": "80",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
"reqd": 1
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "to_date", fieldname: "to_date",

View File

@@ -22,14 +22,24 @@ frappe.query_reports["Incorrect Serial No Valuation"] = {
fieldtype: "Date", fieldtype: "Date",
fieldname: "from_date", fieldname: "from_date",
reqd: 1, reqd: 1,
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
label: __("To Date"), label: __("To Date"),
fieldtype: "Date", fieldtype: "Date",
fieldname: "to_date", fieldname: "to_date",
reqd: 1, reqd: 1,
<<<<<<< HEAD
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2], default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
}, },
], ],
=======
default: erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[2],
}
]
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}; };

View File

@@ -4,10 +4,17 @@
frappe.query_reports["Itemwise Recommended Reorder Level"] = { frappe.query_reports["Itemwise Recommended Reorder Level"] = {
filters: [ filters: [
{ {
<<<<<<< HEAD
fieldname: "from_date", fieldname: "from_date",
label: __("From Date"), label: __("From Date"),
fieldtype: "Date", fieldtype: "Date",
default: frappe.sys_defaults.year_start_date, default: frappe.sys_defaults.year_start_date,
=======
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), with_dates=true)[1],
>>>>>>> 4496a6760e (fix: Default year start and end dates in reports)
}, },
{ {
fieldname: "to_date", fieldname: "to_date",