From c3244f009bc5bcafa3befa3751a603aa9cf7ebb4 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 24 Apr 2024 16:59:51 +0530 Subject: [PATCH 01/13] fix: Default dates in report --- .../asset_depreciations_and_balances.js | 4 ++-- .../bank_clearance_summary.js | 2 +- .../dimension_wise_accounts_balance_report.js | 4 ++-- .../report/gross_profit/gross_profit.js | 4 ++-- .../payment_period_based_on_invoice_date.js | 2 +- .../profitability_analysis.js | 4 ++-- .../report/trial_balance/trial_balance.js | 4 ++-- .../trial_balance_for_party.js | 4 ++-- .../procurement_tracker.js | 4 ++-- .../purchase_analytics/purchase_analytics.js | 4 ++-- .../campaign_efficiency.js | 4 ++-- .../lead_owner_efficiency.js | 4 ++-- .../job_card_summary/job_card_summary.js | 4 ++-- .../production_analytics.js | 4 ++-- erpnext/public/js/utils.js | 21 ++++++++++++------- .../customer_acquisition_and_loyalty.js | 4 ++-- .../report/sales_analytics/sales_analytics.js | 4 ++-- .../sales_person_commission_summary.js | 2 +- .../sales_person_wise_transaction_summary.js | 2 +- .../incorrect_serial_no_valuation.js | 4 ++-- 20 files changed, 47 insertions(+), 42 deletions(-) diff --git a/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.js b/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.js index 1da35cd95bf..5f78b779342 100644 --- a/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.js +++ b/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.js @@ -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(), 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(), true)[2], "reqd": 1 }, { diff --git a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js index f0b6c6b20ac..8a7d071a474 100644 --- a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js +++ b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js @@ -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(), true)[1], "width": "80" }, { 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 9d416db4fdd..33d51066dac 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 @@ -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(), 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(), true)[2], "reqd": 1 }, { diff --git a/erpnext/accounts/report/gross_profit/gross_profit.js b/erpnext/accounts/report/gross_profit/gross_profit.js index cf4ccef2433..8e05cf86061 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.js +++ b/erpnext/accounts/report/gross_profit/gross_profit.js @@ -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(), 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(), true)[2], "reqd": 1 }, { diff --git a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js index 2343eaa8461..5ec2c9880c3 100644 --- a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js +++ b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js @@ -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(), true)[1], }, { fieldname:"to_date", diff --git a/erpnext/accounts/report/profitability_analysis/profitability_analysis.js b/erpnext/accounts/report/profitability_analysis/profitability_analysis.js index c4054a977a8..b3b32c08c4c 100644 --- a/erpnext/accounts/report/profitability_analysis/profitability_analysis.js +++ b/erpnext/accounts/report/profitability_analysis/profitability_analysis.js @@ -59,13 +59,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(), 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(), true)[2], }, { "fieldname": "show_zero_values", diff --git a/erpnext/accounts/report/trial_balance/trial_balance.js b/erpnext/accounts/report/trial_balance/trial_balance.js index ffb2931e902..ee1d5e3dba0 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.js +++ b/erpnext/accounts/report/trial_balance/trial_balance.js @@ -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(), 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(), true)[2], }, { "fieldname": "cost_center", 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 0f7578cdc17..33c644adcb9 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 @@ -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(), 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(), true)[2], }, { "fieldname":"party_type", diff --git a/erpnext/buying/report/procurement_tracker/procurement_tracker.js b/erpnext/buying/report/procurement_tracker/procurement_tracker.js index 283d56c9469..4d119a5cd75 100644 --- a/erpnext/buying/report/procurement_tracker/procurement_tracker.js +++ b/erpnext/buying/report/procurement_tracker/procurement_tracker.js @@ -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(), 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(), true)[2], }, ] } diff --git a/erpnext/buying/report/purchase_analytics/purchase_analytics.js b/erpnext/buying/report/purchase_analytics/purchase_analytics.js index a884f06d2c2..fe3bbc9bd89 100644 --- a/erpnext/buying/report/purchase_analytics/purchase_analytics.js +++ b/erpnext/buying/report/purchase_analytics/purchase_analytics.js @@ -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(), 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(), true)[2], reqd: 1 }, { diff --git a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js index f29c2c64e14..0c4e7f2dabe 100644 --- a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js +++ b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.js @@ -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(), 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(), true)[2], } ] }; diff --git a/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.js b/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.js index bbfd6ac9ff7..6fc52a1afc9 100644 --- a/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.js +++ b/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.js @@ -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(), 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(), true)[2], } ]}; 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 a874f224820..9f1098d46fc 100644 --- a/erpnext/manufacturing/report/job_card_summary/job_card_summary.js +++ b/erpnext/manufacturing/report/job_card_summary/job_card_summary.js @@ -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(), 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(), true)[2], reqd: 1, }, { diff --git a/erpnext/manufacturing/report/production_analytics/production_analytics.js b/erpnext/manufacturing/report/production_analytics/production_analytics.js index 99f9b1260a2..7c71b2eac65 100644 --- a/erpnext/manufacturing/report/production_analytics/production_analytics.js +++ b/erpnext/manufacturing/report/production_analytics/production_analytics.js @@ -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(), 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(), true)[2], reqd: 1 }, { diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 4c7b2534fcc..fef55942e46 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -351,26 +351,31 @@ $.extend(erpnext.utils, { }, - get_fiscal_year: function(date) { - if(!date) { + get_fiscal_year: function (date, with_dates = false, boolean = false) { + if (!frappe.boot.setup_complete) { + return; + } + if (!date) { date = frappe.datetime.get_today(); } - let fiscal_year = ''; + let fiscal_year = ""; frappe.call({ method: "erpnext.accounts.utils.get_fiscal_year", args: { - date: date + date: date, + boolean: boolean, }, async: false, - callback: function(r) { + callback: function (r) { if (r.message) { - fiscal_year = r.message[0]; + if (with_dates) fiscal_year = r.message; + else fiscal_year = r.message[0]; } - } + }, }); return fiscal_year; - } + }, }); erpnext.utils.select_alternate_items = function(opts) { diff --git a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js index 1b931e12de3..744b5d982b5 100644 --- a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js +++ b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js @@ -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(), 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(), true)[2], "reqd": 1 } ], diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.js b/erpnext/selling/report/sales_analytics/sales_analytics.js index 87dd02f9915..e56fe8b5732 100644 --- a/erpnext/selling/report/sales_analytics/sales_analytics.js +++ b/erpnext/selling/report/sales_analytics/sales_analytics.js @@ -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(), 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(), true)[2], reqd: 1 }, { diff --git a/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.js b/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.js index ba6ee784b91..2044ff8c289 100644 --- a/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.js +++ b/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.js @@ -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(), true)[1], }, { fieldname:"to_date", diff --git a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js index e269f02d0ce..80c7b5f59d7 100644 --- a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js +++ b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js @@ -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(), true)[1], }, { fieldname:"to_date", diff --git a/erpnext/stock/report/incorrect_serial_no_valuation/incorrect_serial_no_valuation.js b/erpnext/stock/report/incorrect_serial_no_valuation/incorrect_serial_no_valuation.js index c62d48081c2..ff27fb32cd8 100644 --- a/erpnext/stock/report/incorrect_serial_no_valuation/incorrect_serial_no_valuation.js +++ b/erpnext/stock/report/incorrect_serial_no_valuation/incorrect_serial_no_valuation.js @@ -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(), 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(), true)[2] } ] }; From 754e193c7647f7d996d042b13ed19ea962d7e9a5 Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Tue, 16 Apr 2024 18:06:42 +0530 Subject: [PATCH 02/13] fix: address filter and quotation to for prospect (cherry picked from commit fe5b88522e8fdc11f64ff0136e41a9c1e18838d1) # Conflicts: # erpnext/selling/doctype/quotation/quotation.js --- erpnext/accounts/party.py | 2 +- erpnext/selling/doctype/quotation/quotation.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 2b95e16f356..27b78d3c3a9 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -188,7 +188,7 @@ def set_address_details( *, ignore_permissions=False, ): - billing_address_field = "customer_address" if party_type == "Lead" else party_type.lower() + "_address" + billing_address_field = "customer_address" if party_type in ["Lead", "Prospect"] else party_type.lower() + "_address" party_details[billing_address_field] = party_address or get_default_address(party_type, party.name) if doctype: party_details.update( diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 2d5c3fa961d..6dcebb082aa 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -45,6 +45,8 @@ frappe.ui.form.on('Quotation', { frm.trigger("set_label"); frm.trigger("toggle_reqd_lead_customer"); frm.trigger("set_dynamic_field_label"); + frm.set_value("party_name", '') + frm.set_value("customer_name", '') }, set_label: function(frm) { @@ -68,10 +70,23 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. } refresh(doc, dt, dn) { super.refresh(doc, dt, dn); + let doctype = ""; + if (doc.quotation_to == "Customer") { + doctype = "Customer"; + } else if (doc.quotation_to == "Lead") { + doctype = "Lead"; + } else if (doc.quotation_to == "Prospect") { + doctype = "Prospect"; + } frappe.dynamic_link = { doc: this.frm.doc, +<<<<<<< HEAD fieldname: 'party_name', doctype: doc.quotation_to == 'Customer' ? 'Customer' : 'Lead', +======= + fieldname: "party_name", + doctype: doctype, +>>>>>>> fe5b88522e (fix: address filter and quotation to for prospect) }; var me = this; @@ -170,6 +185,7 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. } } else if (this.frm.doc.quotation_to == "Prospect") { this.frm.set_df_property("party_name", "label", "Prospect"); + this.frm.fields_dict.party_name.get_query = null; } } From 690278042d260f78d2cfd9b72cff809c710becdf Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Tue, 16 Apr 2024 18:12:20 +0530 Subject: [PATCH 03/13] fix: address filter and quotation to for prospect (cherry picked from commit 24a68a79dfb284843677f46a9e1f768eead5fcd5) --- erpnext/accounts/party.py | 4 +++- erpnext/selling/doctype/quotation/quotation.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 27b78d3c3a9..8240b79bfdc 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -188,7 +188,9 @@ def set_address_details( *, ignore_permissions=False, ): - billing_address_field = "customer_address" if party_type in ["Lead", "Prospect"] else party_type.lower() + "_address" + billing_address_field = ( + "customer_address" if party_type in ["Lead", "Prospect"] else party_type.lower() + "_address" + ) party_details[billing_address_field] = party_address or get_default_address(party_type, party.name) if doctype: party_details.update( diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 6dcebb082aa..654d96790eb 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -45,8 +45,8 @@ frappe.ui.form.on('Quotation', { frm.trigger("set_label"); frm.trigger("toggle_reqd_lead_customer"); frm.trigger("set_dynamic_field_label"); - frm.set_value("party_name", '') - frm.set_value("customer_name", '') + frm.set_value("party_name", "") + frm.set_value("customer_name", "") }, set_label: function(frm) { From c9e7f450c5d771c0469214d22f68be947ec30775 Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Tue, 16 Apr 2024 18:13:49 +0530 Subject: [PATCH 04/13] fix: address filter and quotation to for prospect (cherry picked from commit 2896e3666c4f034912e3d0046c0036a6f0512a73) --- erpnext/selling/doctype/quotation/quotation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 654d96790eb..37c80da95ca 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -45,8 +45,8 @@ frappe.ui.form.on('Quotation', { frm.trigger("set_label"); frm.trigger("toggle_reqd_lead_customer"); frm.trigger("set_dynamic_field_label"); - frm.set_value("party_name", "") - frm.set_value("customer_name", "") + frm.set_value("party_name", ""); + frm.set_value("customer_name", ""); }, set_label: function(frm) { From c4dfcbec96b4df318fd140e6b50c3ecd8c195854 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 9 May 2024 11:58:33 +0530 Subject: [PATCH 05/13] refactor: make use of doc.quotation_to (cherry picked from commit 754c7f6d1ca0e20d5673dea79b15097e5c66ea3b) # Conflicts: # erpnext/selling/doctype/quotation/quotation.js --- erpnext/selling/doctype/quotation/quotation.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 37c80da95ca..1dc6e7f27da 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -70,14 +70,6 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. } refresh(doc, dt, dn) { super.refresh(doc, dt, dn); - let doctype = ""; - if (doc.quotation_to == "Customer") { - doctype = "Customer"; - } else if (doc.quotation_to == "Lead") { - doctype = "Lead"; - } else if (doc.quotation_to == "Prospect") { - doctype = "Prospect"; - } frappe.dynamic_link = { doc: this.frm.doc, <<<<<<< HEAD @@ -85,8 +77,12 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. doctype: doc.quotation_to == 'Customer' ? 'Customer' : 'Lead', ======= fieldname: "party_name", +<<<<<<< HEAD doctype: doctype, >>>>>>> fe5b88522e (fix: address filter and quotation to for prospect) +======= + doctype: doc.quotation_to, +>>>>>>> 754c7f6d1c (refactor: make use of doc.quotation_to) }; var me = this; From 0404941fb2925f585c94015ae573a88f043ca75c Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 9 May 2024 12:21:29 +0530 Subject: [PATCH 06/13] chore: resolve conflict --- erpnext/selling/doctype/quotation/quotation.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 1dc6e7f27da..d2f565ef70e 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -72,17 +72,8 @@ erpnext.selling.QuotationController = class QuotationController extends erpnext. super.refresh(doc, dt, dn); frappe.dynamic_link = { doc: this.frm.doc, -<<<<<<< HEAD fieldname: 'party_name', - doctype: doc.quotation_to == 'Customer' ? 'Customer' : 'Lead', -======= - fieldname: "party_name", -<<<<<<< HEAD - doctype: doctype, ->>>>>>> fe5b88522e (fix: address filter and quotation to for prospect) -======= doctype: doc.quotation_to, ->>>>>>> 754c7f6d1c (refactor: make use of doc.quotation_to) }; var me = this; From 1078a98cce0489201cec4386de8d0143d7542d2a Mon Sep 17 00:00:00 2001 From: HarryPaulo Date: Mon, 11 Sep 2023 17:57:31 -0300 Subject: [PATCH 07/13] fix: "Based on" field always has the value "Not applicable" (cherry picked from commit fae640c56fa21acf18c1ebb7f9aea1a440e7a46e) --- erpnext/setup/doctype/authorization_rule/authorization_rule.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/erpnext/setup/doctype/authorization_rule/authorization_rule.py b/erpnext/setup/doctype/authorization_rule/authorization_rule.py index 1bf9aa61c33..e232271cadb 100644 --- a/erpnext/setup/doctype/authorization_rule/authorization_rule.py +++ b/erpnext/setup/doctype/authorization_rule/authorization_rule.py @@ -53,8 +53,6 @@ class AuthorizationRule(Document): frappe.throw(_("Discount must be less than 100")) elif self.based_on == "Customerwise Discount" and not self.master_name: frappe.throw(_("Customer required for 'Customerwise Discount'")) - else: - self.based_on = "Not Applicable" def validate(self): self.check_duplicate_entry() From 256d6a47ac1f6fec39e1ccd501f587037f74da8d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 17:42:27 +0200 Subject: [PATCH 08/13] fix: consistent use of "Address & Contact" (backport #41386) (#41387) Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com> fix: consistent use of "Address & Contact" (#41386) --- erpnext/accounts/doctype/sales_invoice/sales_invoice.json | 4 ++-- erpnext/buying/doctype/supplier/supplier.json | 4 ++-- erpnext/selling/doctype/customer/customer.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 25f11b65e49..cf7d01c4035 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -2030,7 +2030,7 @@ { "fieldname": "contact_and_address_tab", "fieldtype": "Tab Break", - "label": "Contact & Address" + "label": "Address & Contact" }, { "fieldname": "payments_tab", @@ -2184,7 +2184,7 @@ "link_fieldname": "consolidated_invoice" } ], - "modified": "2024-03-22 17:50:34.395602", + "modified": "2024-05-08 18:02:28.549041", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json index 5ac8cde50fe..944eb985246 100644 --- a/erpnext/buying/doctype/supplier/supplier.json +++ b/erpnext/buying/doctype/supplier/supplier.json @@ -402,7 +402,7 @@ { "fieldname": "contact_and_address_tab", "fieldtype": "Tab Break", - "label": "Contact & Address" + "label": "Address & Contact" }, { "fieldname": "accounting_tab", @@ -457,7 +457,7 @@ "link_fieldname": "party" } ], - "modified": "2023-10-19 16:55:15.148325", + "modified": "2024-05-08 18:02:57.342931", "modified_by": "Administrator", "module": "Buying", "name": "Supplier", diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index 9844e0902c4..e272f09679c 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -481,7 +481,7 @@ { "fieldname": "contact_and_address_tab", "fieldtype": "Tab Break", - "label": "Contact & Address" + "label": "Address & Contact" }, { "fieldname": "defaults_tab", @@ -567,7 +567,7 @@ "link_fieldname": "party" } ], - "modified": "2023-12-28 13:15:36.298369", + "modified": "2024-05-08 18:03:20.716169", "modified_by": "Administrator", "module": "Selling", "name": "Customer", From 7a380f584d9be2f6a78bfdb5e5711002ccb945b4 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sat, 11 May 2024 17:51:53 +0530 Subject: [PATCH 09/13] fix: default fiscal year --- erpnext/accounts/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index d966074b2ae..57ecc9e9275 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -55,6 +55,9 @@ GL_REPOSTING_CHUNK = 100 def get_fiscal_year( date=None, fiscal_year=None, label="Date", verbose=1, company=None, as_dict=False, boolean=False ): + if isinstance(boolean, str): + boolean = frappe.json.loads(boolean) + fiscal_years = get_fiscal_years( date, fiscal_year, label, verbose, company, as_dict=as_dict, boolean=boolean ) From 536635640059aa2234cac29010e06a03fd4eb1b9 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 16:31:34 +0530 Subject: [PATCH 10/13] fix: data getting override in delivery trip (backport #41431) (#41432) fix: data getting override in delivery trip (#41431) fix: data getting override (cherry picked from commit 663fcb374d644507299d12bde1177cb432728cf7) Co-authored-by: rohitwaghchaure --- erpnext/stock/doctype/delivery_trip/delivery_trip.js | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/stock/doctype/delivery_trip/delivery_trip.js b/erpnext/stock/doctype/delivery_trip/delivery_trip.js index 77eae534d17..4f8649c0bfa 100755 --- a/erpnext/stock/doctype/delivery_trip/delivery_trip.js +++ b/erpnext/stock/doctype/delivery_trip/delivery_trip.js @@ -51,7 +51,6 @@ frappe.ui.form.on("Delivery Trip", { frm.add_custom_button( __("Delivery Note"), () => { - frm.clear_table("delivery_stops"); erpnext.utils.map_current_doc({ method: "erpnext.stock.doctype.delivery_note.delivery_note.make_delivery_trip", source_doctype: "Delivery Note", From 7b28d7d2b8cc2f71a175af1793ed28636faa2f5e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 21:37:13 +0530 Subject: [PATCH 11/13] feat: allow to pick manually qty / batches / serial nos (backport #40723) (#41435) * feat: allow to pick manually qty / batches / serial nos (cherry picked from commit 50dd9fa8a32b8cd29b50d1c6181dfd8f6f5d27b6) # Conflicts: # erpnext/stock/doctype/pick_list/pick_list.json # erpnext/stock/doctype/pick_list/pick_list.py * chore: fix conflicts * chore: fix conflicts --------- Co-authored-by: Rohit Waghchaure --- erpnext/stock/doctype/pick_list/pick_list.json | 12 ++++++++++-- erpnext/stock/doctype/pick_list/pick_list.py | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/pick_list/pick_list.json b/erpnext/stock/doctype/pick_list/pick_list.json index 948011cce69..b4aadbd7987 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.json +++ b/erpnext/stock/doctype/pick_list/pick_list.json @@ -18,6 +18,7 @@ "parent_warehouse", "consider_rejected_warehouses", "get_item_locations", + "pick_manually", "section_break_6", "scan_barcode", "column_break_13", @@ -192,11 +193,18 @@ "fieldname": "consider_rejected_warehouses", "fieldtype": "Check", "label": "Consider Rejected Warehouses" + }, + { + "default": "0", + "description": "If enabled then system won't override the picked qty / batches / serial numbers.", + "fieldname": "pick_manually", + "fieldtype": "Check", + "label": "Pick Manually" } ], "is_submittable": 1, "links": [], - "modified": "2024-01-24 17:05:20.317180", + "modified": "2024-03-27 22:49:16.954637", "modified_by": "Administrator", "module": "Stock", "name": "Pick List", @@ -268,4 +276,4 @@ "sort_order": "DESC", "states": [], "track_changes": 1 -} \ No newline at end of file +} diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py index ef7dc710b13..99858835fed 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.py +++ b/erpnext/stock/doctype/pick_list/pick_list.py @@ -29,7 +29,8 @@ class PickList(Document): def before_save(self): self.update_status() - self.set_item_locations() + if not self.pick_manually: + self.set_item_locations() if self.get("locations"): self.validate_sales_order_percentage() From a8be5f078956a4269bb5fa6e87950d359bc38b9a Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sat, 11 May 2024 19:35:52 +0530 Subject: [PATCH 12/13] fix: Duplicate party name column in AR/AP report (cherry picked from commit 7501fe8ebd9c0735fcdb62529f275d970a86cca5) --- .../accounts_receivable/accounts_receivable.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 25143e555d3..be42da8423f 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -1028,20 +1028,6 @@ class ReceivablePayableReport: fieldtype="Link", options="Contact", ) - if self.filters.party_type == "Customer": - self.add_column( - _("Customer Name"), - fieldname="customer_name", - fieldtype="Link", - options="Customer", - ) - elif self.filters.party_type == "Supplier": - self.add_column( - _("Supplier Name"), - fieldname="supplier_name", - fieldtype="Link", - options="Supplier", - ) self.add_column(label=_("Cost Center"), fieldname="cost_center", fieldtype="Data") self.add_column(label=_("Voucher Type"), fieldname="voucher_type", fieldtype="Data") From e69e5404d3da90a17462fd2ec87cab94f0c47a1c Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Tue, 30 Apr 2024 12:50:21 +0530 Subject: [PATCH 13/13] fix: PSOA ageing (cherry picked from commit fed2d1190581449d78cb160b214e0b47130f5169) --- .../process_statement_of_accounts.py | 2 +- ...cess_statement_of_accounts_accounts_receivable.html | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py index 0c266ce7947..a602e0d7df3 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py +++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py @@ -104,7 +104,7 @@ def set_ageing(doc, entry): ageing_filters = frappe._dict( { "company": doc.company, - "report_date": doc.to_date, + "report_date": doc.posting_date, "ageing_based_on": doc.ageing_based_on, "range1": 30, "range2": 60, diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts_accounts_receivable.html b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts_accounts_receivable.html index 647600a9fea..bf8de073853 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts_accounts_receivable.html +++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts_accounts_receivable.html @@ -340,10 +340,11 @@ - - - - + + + + + @@ -352,6 +353,7 @@ +
30 Days60 Days90 Days120 Days0 - 30 Days30 - 60 Days60 - 90 Days90 - 120 DaysAbove 120 Days
{{ frappe.utils.fmt_money(ageing.range2, currency=data[0]["currency"]) }} {{ frappe.utils.fmt_money(ageing.range3, currency=data[0]["currency"]) }} {{ frappe.utils.fmt_money(ageing.range4, currency=data[0]["currency"]) }}{{ frappe.utils.fmt_money(ageing.range5, currency=filters.presentation_currency) }}