mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-27 02:28:30 +00:00
* fix: renaming group by fieldname and value in reports (#47352)
* fix: renaming in general ledger report
* fix: renaming in supplier quotation comparison report
* fix: renaming group by to categorize by in process statement of accounts
* fix: added patch
* fix: patch update to all documents
* chore: added patches to patch.txt
* chore: removing patch from v14
(cherry picked from commit 13a84e7f82)
# Conflicts:
# erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json
# erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
# erpnext/accounts/report/general_ledger/general_ledger.py
# erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.py
# erpnext/patches.txt
# erpnext/patches/v14_0/rename_group_by_to_categorize_by.py
* chore: resolve conflict
* chore: resolve conflict
* chore: resolve conflict
* chore: resolve conflict
* chore: resolve conflict
* chore: resolve conflict
* chore: fixed path for patch file
---------
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
"posting_date",
|
"posting_date",
|
||||||
"company",
|
"company",
|
||||||
"account",
|
"account",
|
||||||
"group_by",
|
"categorize_by",
|
||||||
"cost_center",
|
"cost_center",
|
||||||
"territory",
|
"territory",
|
||||||
"ignore_exchange_rate_revaluation_journals",
|
"ignore_exchange_rate_revaluation_journals",
|
||||||
@@ -172,14 +172,6 @@
|
|||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"label": "Start Date"
|
"label": "Start Date"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"default": "Group by Voucher (Consolidated)",
|
|
||||||
"depends_on": "eval:(doc.report == 'General Ledger');",
|
|
||||||
"fieldname": "group_by",
|
|
||||||
"fieldtype": "Select",
|
|
||||||
"label": "Group By",
|
|
||||||
"options": "\nGroup by Voucher\nGroup by Voucher (Consolidated)"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"depends_on": "eval: (doc.report == 'General Ledger');",
|
"depends_on": "eval: (doc.report == 'General Ledger');",
|
||||||
"fieldname": "currency",
|
"fieldname": "currency",
|
||||||
@@ -395,10 +387,18 @@
|
|||||||
"fieldname": "show_remarks",
|
"fieldname": "show_remarks",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Show Remarks"
|
"label": "Show Remarks"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "Categorize by Voucher (Consolidated)",
|
||||||
|
"depends_on": "eval:(doc.report == 'General Ledger');",
|
||||||
|
"fieldname": "categorize_by",
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"label": "Categorize By",
|
||||||
|
"options": "\nCategorize by Voucher\nCategorize by Voucher (Consolidated)"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-10-18 17:51:39.108481",
|
"modified": "2025-04-30 14:43:23.643006",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Process Statement Of Accounts",
|
"name": "Process Statement Of Accounts",
|
||||||
@@ -433,4 +433,4 @@
|
|||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"track_changes": 1
|
"track_changes": 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ def get_gl_filters(doc, entry, tax_id, presentation_currency):
|
|||||||
"party": [entry.customer],
|
"party": [entry.customer],
|
||||||
"party_name": [entry.customer_name] if entry.customer_name else None,
|
"party_name": [entry.customer_name] if entry.customer_name else None,
|
||||||
"presentation_currency": presentation_currency,
|
"presentation_currency": presentation_currency,
|
||||||
"group_by": doc.group_by,
|
"categorize_by": doc.categorize_by,
|
||||||
"currency": doc.currency,
|
"currency": doc.currency,
|
||||||
"project": [p.project_name for p in doc.project],
|
"project": [p.project_name for p in doc.project],
|
||||||
"show_opening_entries": 0,
|
"show_opening_entries": 0,
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ frappe.query_reports["General Ledger"] = {
|
|||||||
label: __("Voucher No"),
|
label: __("Voucher No"),
|
||||||
fieldtype: "Data",
|
fieldtype: "Data",
|
||||||
on_change: function () {
|
on_change: function () {
|
||||||
frappe.query_report.set_filter_value("group_by", "Group by Voucher (Consolidated)");
|
frappe.query_report.set_filter_value("categorize_by", "Categorize by Voucher (Consolidated)");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -112,29 +112,29 @@ frappe.query_reports["General Ledger"] = {
|
|||||||
hidden: 1,
|
hidden: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: "group_by",
|
fieldname: "categorize_by",
|
||||||
label: __("Group by"),
|
label: __("Categorize by"),
|
||||||
fieldtype: "Select",
|
fieldtype: "Select",
|
||||||
options: [
|
options: [
|
||||||
"",
|
"",
|
||||||
{
|
{
|
||||||
label: __("Group by Voucher"),
|
label: __("Categorize by Voucher"),
|
||||||
value: "Group by Voucher",
|
value: "Categorize by Voucher",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __("Group by Voucher (Consolidated)"),
|
label: __("Categorize by Voucher (Consolidated)"),
|
||||||
value: "Group by Voucher (Consolidated)",
|
value: "Categorize by Voucher (Consolidated)",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __("Group by Account"),
|
label: __("Categorize by Account"),
|
||||||
value: "Group by Account",
|
value: "Categorize by Account",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __("Group by Party"),
|
label: __("Categorize by Party"),
|
||||||
value: "Group by Party",
|
value: "Categorize by Party",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: "Group by Voucher (Consolidated)",
|
default: "Categorize by Voucher (Consolidated)",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: "tax_id",
|
fieldname: "tax_id",
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ def validate_filters(filters, account_details):
|
|||||||
if not account_details.get(account):
|
if not account_details.get(account):
|
||||||
frappe.throw(_("Account {0} does not exists").format(account))
|
frappe.throw(_("Account {0} does not exists").format(account))
|
||||||
|
|
||||||
if filters.get("account") and filters.get("group_by") == "Group by Account":
|
if filters.get("account") and filters.get("categorize_by") == "Categorize by Account":
|
||||||
filters.account = frappe.parse_json(filters.get("account"))
|
filters.account = frappe.parse_json(filters.get("account"))
|
||||||
for account in filters.account:
|
for account in filters.account:
|
||||||
if account_details[account].is_group == 0:
|
if account_details[account].is_group == 0:
|
||||||
frappe.throw(_("Can not filter based on Child Account, if grouped by Account"))
|
frappe.throw(_("Can not filter based on Child Account, if grouped by Account"))
|
||||||
|
|
||||||
if filters.get("voucher_no") and filters.get("group_by") in ["Group by Voucher"]:
|
if filters.get("voucher_no") and filters.get("categorize_by") in ["Categorize by Voucher"]:
|
||||||
frappe.throw(_("Can not filter based on Voucher No, if grouped by Voucher"))
|
frappe.throw(_("Can not filter based on Voucher No, if grouped by Voucher"))
|
||||||
|
|
||||||
if filters.from_date > filters.to_date:
|
if filters.from_date > filters.to_date:
|
||||||
@@ -172,9 +172,9 @@ def get_gl_entries(filters, accounting_dimensions):
|
|||||||
if filters.get("include_dimensions"):
|
if filters.get("include_dimensions"):
|
||||||
order_by_statement = "order by posting_date, creation"
|
order_by_statement = "order by posting_date, creation"
|
||||||
|
|
||||||
if filters.get("group_by") == "Group by Voucher":
|
if filters.get("categorize_by") == "Categorize by Voucher":
|
||||||
order_by_statement = "order by posting_date, voucher_type, voucher_no"
|
order_by_statement = "order by posting_date, voucher_type, voucher_no"
|
||||||
if filters.get("group_by") == "Group by Account":
|
if filters.get("categorize_by") == "Categorize by Account":
|
||||||
order_by_statement = "order by account, posting_date, creation"
|
order_by_statement = "order by account, posting_date, creation"
|
||||||
|
|
||||||
if filters.get("include_default_book_entries"):
|
if filters.get("include_default_book_entries"):
|
||||||
@@ -261,7 +261,7 @@ def get_conditions(filters):
|
|||||||
if filters.get("voucher_no_not_in"):
|
if filters.get("voucher_no_not_in"):
|
||||||
conditions.append("voucher_no not in %(voucher_no_not_in)s")
|
conditions.append("voucher_no not in %(voucher_no_not_in)s")
|
||||||
|
|
||||||
if filters.get("group_by") == "Group by Party" and not filters.get("party_type"):
|
if filters.get("categorize_by") == "Categorize by Party" and not filters.get("party_type"):
|
||||||
conditions.append("party_type in ('Customer', 'Supplier')")
|
conditions.append("party_type in ('Customer', 'Supplier')")
|
||||||
|
|
||||||
if filters.get("party_type"):
|
if filters.get("party_type"):
|
||||||
@@ -273,7 +273,7 @@ def get_conditions(filters):
|
|||||||
if not (
|
if not (
|
||||||
filters.get("account")
|
filters.get("account")
|
||||||
or filters.get("party")
|
or filters.get("party")
|
||||||
or filters.get("group_by") in ["Group by Account", "Group by Party"]
|
or filters.get("categorize_by") in ["Categorize by Account", "Categorize by Party"]
|
||||||
):
|
):
|
||||||
if not ignore_is_opening:
|
if not ignore_is_opening:
|
||||||
conditions.append("(posting_date >=%(from_date)s or is_opening = 'Yes')")
|
conditions.append("(posting_date >=%(from_date)s or is_opening = 'Yes')")
|
||||||
@@ -368,13 +368,13 @@ def get_data_with_opening_closing(filters, account_details, accounting_dimension
|
|||||||
# Opening for filtered account
|
# Opening for filtered account
|
||||||
data.append(totals.opening)
|
data.append(totals.opening)
|
||||||
|
|
||||||
if filters.get("group_by") != "Group by Voucher (Consolidated)":
|
if filters.get("categorize_by") != "Categorize by Voucher (Consolidated)":
|
||||||
for _acc, acc_dict in gle_map.items():
|
for _acc, acc_dict in gle_map.items():
|
||||||
# acc
|
# acc
|
||||||
if acc_dict.entries:
|
if acc_dict.entries:
|
||||||
# opening
|
# opening
|
||||||
data.append({})
|
data.append({})
|
||||||
if filters.get("group_by") != "Group by Voucher":
|
if filters.get("categorize_by") != "Categorize by Voucher":
|
||||||
data.append(acc_dict.totals.opening)
|
data.append(acc_dict.totals.opening)
|
||||||
|
|
||||||
data += acc_dict.entries
|
data += acc_dict.entries
|
||||||
@@ -383,7 +383,7 @@ def get_data_with_opening_closing(filters, account_details, accounting_dimension
|
|||||||
data.append(acc_dict.totals.total)
|
data.append(acc_dict.totals.total)
|
||||||
|
|
||||||
# closing
|
# closing
|
||||||
if filters.get("group_by") != "Group by Voucher":
|
if filters.get("categorize_by") != "Categorize by Voucher":
|
||||||
data.append(acc_dict.totals.closing)
|
data.append(acc_dict.totals.closing)
|
||||||
data.append({})
|
data.append({})
|
||||||
else:
|
else:
|
||||||
@@ -416,9 +416,9 @@ def get_totals_dict():
|
|||||||
|
|
||||||
|
|
||||||
def group_by_field(group_by):
|
def group_by_field(group_by):
|
||||||
if group_by == "Group by Party":
|
if group_by == "Categorize by Party":
|
||||||
return "party"
|
return "party"
|
||||||
elif group_by in ["Group by Voucher (Consolidated)", "Group by Account"]:
|
elif group_by in ["Categorize by Voucher (Consolidated)", "Categorize by Account"]:
|
||||||
return "account"
|
return "account"
|
||||||
else:
|
else:
|
||||||
return "voucher_no"
|
return "voucher_no"
|
||||||
@@ -426,7 +426,7 @@ def group_by_field(group_by):
|
|||||||
|
|
||||||
def initialize_gle_map(gl_entries, filters):
|
def initialize_gle_map(gl_entries, filters):
|
||||||
gle_map = OrderedDict()
|
gle_map = OrderedDict()
|
||||||
group_by = group_by_field(filters.get("group_by"))
|
group_by = group_by_field(filters.get("categorize_by"))
|
||||||
|
|
||||||
for gle in gl_entries:
|
for gle in gl_entries:
|
||||||
gle_map.setdefault(gle.get(group_by), _dict(totals=get_totals_dict(), entries=[]))
|
gle_map.setdefault(gle.get(group_by), _dict(totals=get_totals_dict(), entries=[]))
|
||||||
@@ -437,8 +437,8 @@ def get_accountwise_gle(filters, accounting_dimensions, gl_entries, gle_map):
|
|||||||
totals = get_totals_dict()
|
totals = get_totals_dict()
|
||||||
entries = []
|
entries = []
|
||||||
consolidated_gle = OrderedDict()
|
consolidated_gle = OrderedDict()
|
||||||
group_by = group_by_field(filters.get("group_by"))
|
group_by = group_by_field(filters.get("categorize_by"))
|
||||||
group_by_voucher_consolidated = filters.get("group_by") == "Group by Voucher (Consolidated)"
|
group_by_voucher_consolidated = filters.get("categorize_by") == "Categorize by Voucher (Consolidated)"
|
||||||
|
|
||||||
if filters.get("show_net_values_in_party_account"):
|
if filters.get("show_net_values_in_party_account"):
|
||||||
account_type_map = get_account_type_map(filters.get("company"))
|
account_type_map = get_account_type_map(filters.get("company"))
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class TestGeneralLedger(FrappeTestCase):
|
|||||||
"from_date": today(),
|
"from_date": today(),
|
||||||
"to_date": today(),
|
"to_date": today(),
|
||||||
"account": [account.name],
|
"account": [account.name],
|
||||||
"group_by": "Group by Voucher (Consolidated)",
|
"categorize_by": "Categorize by Voucher (Consolidated)",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -246,7 +246,7 @@ class TestGeneralLedger(FrappeTestCase):
|
|||||||
"from_date": today(),
|
"from_date": today(),
|
||||||
"to_date": today(),
|
"to_date": today(),
|
||||||
"account": [account.name],
|
"account": [account.name],
|
||||||
"group_by": "Group by Voucher (Consolidated)",
|
"categorize_by": "Categorize by Voucher (Consolidated)",
|
||||||
"ignore_err": True,
|
"ignore_err": True,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -261,7 +261,7 @@ class TestGeneralLedger(FrappeTestCase):
|
|||||||
"from_date": today(),
|
"from_date": today(),
|
||||||
"to_date": today(),
|
"to_date": today(),
|
||||||
"account": [account.name],
|
"account": [account.name],
|
||||||
"group_by": "Group by Voucher (Consolidated)",
|
"categorize_by": "Categorize by Voucher (Consolidated)",
|
||||||
"ignore_err": False,
|
"ignore_err": False,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -308,7 +308,7 @@ class TestGeneralLedger(FrappeTestCase):
|
|||||||
"from_date": si.posting_date,
|
"from_date": si.posting_date,
|
||||||
"to_date": si.posting_date,
|
"to_date": si.posting_date,
|
||||||
"account": [si.debit_to],
|
"account": [si.debit_to],
|
||||||
"group_by": "Group by Voucher (Consolidated)",
|
"categorize_by": "Categorize by Voucher (Consolidated)",
|
||||||
"ignore_cr_dr_notes": False,
|
"ignore_cr_dr_notes": False,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -325,7 +325,7 @@ class TestGeneralLedger(FrappeTestCase):
|
|||||||
"from_date": si.posting_date,
|
"from_date": si.posting_date,
|
||||||
"to_date": si.posting_date,
|
"to_date": si.posting_date,
|
||||||
"account": [si.debit_to],
|
"account": [si.debit_to],
|
||||||
"group_by": "Group by Voucher (Consolidated)",
|
"categorize_by": "Categorize by Voucher (Consolidated)",
|
||||||
"ignore_cr_dr_notes": True,
|
"ignore_cr_dr_notes": True,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -76,14 +76,14 @@ frappe.query_reports["Supplier Quotation Comparison"] = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldname: "group_by",
|
fieldname: "categorize_by",
|
||||||
label: __("Group by"),
|
label: __("Categorize by"),
|
||||||
fieldtype: "Select",
|
fieldtype: "Select",
|
||||||
options: [
|
options: [
|
||||||
{ label: __("Group by Supplier"), value: "Group by Supplier" },
|
{ label: __("Categorize by Supplier"), value: "Categorize by Supplier" },
|
||||||
{ label: __("Group by Item"), value: "Group by Item" },
|
{ label: __("Categorize by Item"), value: "Categorize by Item" },
|
||||||
],
|
],
|
||||||
default: __("Group by Supplier"),
|
default: __("Categorize by Supplier"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldtype: "Check",
|
fieldtype: "Check",
|
||||||
|
|||||||
@@ -82,7 +82,9 @@ def prepare_data(supplier_quotation_data, filters):
|
|||||||
group_wise_map = defaultdict(list)
|
group_wise_map = defaultdict(list)
|
||||||
supplier_qty_price_map = {}
|
supplier_qty_price_map = {}
|
||||||
|
|
||||||
group_by_field = "supplier_name" if filters.get("group_by") == "Group by Supplier" else "item_code"
|
group_by_field = (
|
||||||
|
"supplier_name" if filters.get("categorize_by") == "Categorize by Supplier" else "item_code"
|
||||||
|
)
|
||||||
company_currency = frappe.db.get_default("currency")
|
company_currency = frappe.db.get_default("currency")
|
||||||
float_precision = cint(frappe.db.get_default("float_precision")) or 2
|
float_precision = cint(frappe.db.get_default("float_precision")) or 2
|
||||||
|
|
||||||
@@ -274,7 +276,7 @@ def get_columns(filters):
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
if filters.get("group_by") == "Group by Item":
|
if filters.get("categorize_by") == "Categorize by Item":
|
||||||
group_by_columns.reverse()
|
group_by_columns.reverse()
|
||||||
|
|
||||||
columns[0:0] = group_by_columns # add positioned group by columns to the report
|
columns[0:0] = group_by_columns # add positioned group by columns to the report
|
||||||
|
|||||||
@@ -372,3 +372,4 @@ erpnext.patches.v14_0.disable_add_row_in_gross_profit
|
|||||||
execute:frappe.db.set_single_value("Accounts Settings", "exchange_gain_loss_posting_date", "Payment")
|
execute:frappe.db.set_single_value("Accounts Settings", "exchange_gain_loss_posting_date", "Payment")
|
||||||
erpnext.patches.v14_0.update_posting_datetime
|
erpnext.patches.v14_0.update_posting_datetime
|
||||||
erpnext.stock.doctype.stock_ledger_entry.patches.ensure_sle_indexes
|
erpnext.stock.doctype.stock_ledger_entry.patches.ensure_sle_indexes
|
||||||
|
erpnext.patches.v14_0.rename_group_by_to_categorize_by
|
||||||
|
|||||||
20
erpnext/patches/v14_0/rename_group_by_to_categorize_by.py
Normal file
20
erpnext/patches/v14_0/rename_group_by_to_categorize_by.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import frappe
|
||||||
|
from frappe.model.utils.rename_field import rename_field
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
rename_field("Process Statement Of Accounts", "group_by", "categorize_by")
|
||||||
|
|
||||||
|
frappe.db.sql(
|
||||||
|
"""
|
||||||
|
UPDATE
|
||||||
|
`tabProcess Statement Of Accounts`
|
||||||
|
SET
|
||||||
|
categorize_by = CASE
|
||||||
|
WHEN categorize_by = 'Group by Voucher (Consolidated)' THEN 'Categorize by Voucher (Consolidated)'
|
||||||
|
WHEN categorize_by = 'Group by Voucher' THEN 'Categorize by Voucher'
|
||||||
|
END
|
||||||
|
WHERE
|
||||||
|
categorize_by IN ('Group by Voucher (Consolidated)', 'Group by Voucher')
|
||||||
|
"""
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user