From e26bc17c75f1dfea1659172216e3449f2271da14 Mon Sep 17 00:00:00 2001 From: Dany Robert Date: Mon, 3 Jun 2024 13:55:12 +0000 Subject: [PATCH] feat(gp): group by cost center --- .../accounts/report/gross_profit/gross_profit.js | 2 +- .../accounts/report/gross_profit/gross_profit.py | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.js b/erpnext/accounts/report/gross_profit/gross_profit.js index 4f65aa615eef..ad194ee90a26 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.js +++ b/erpnext/accounts/report/gross_profit/gross_profit.js @@ -36,7 +36,7 @@ frappe.query_reports["Gross Profit"] = { label: __("Group By"), fieldtype: "Select", options: - "Invoice\nItem Code\nItem Group\nBrand\nWarehouse\nCustomer\nCustomer Group\nTerritory\nSales Person\nProject\nMonthly\nPayment Term", + "Invoice\nItem Code\nItem Group\nBrand\nWarehouse\nCustomer\nCustomer Group\nTerritory\nSales Person\nProject\nCost Center\nMonthly\nPayment Term", default: "Invoice", }, { diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index 6ddb95eb140a..fe2746660ebc 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -125,6 +125,13 @@ def execute(filters=None): "gross_profit_percent", ], "project": ["project", "base_amount", "buying_amount", "gross_profit", "gross_profit_percent"], + "cost_center": [ + "cost_center", + "base_amount", + "buying_amount", + "gross_profit", + "gross_profit_percent", + ], "territory": [ "territory", "base_amount", @@ -304,7 +311,14 @@ def get_columns(group_wise_columns, filters): "fieldname": "project", "fieldtype": "Link", "options": "Project", - "width": 100, + "width": 140, + }, + "cost_center": { + "label": _("Cost Center"), + "fieldname": "cost_center", + "fieldtype": "Link", + "options": "Cost Center", + "width": 140, }, "sales_person": { "label": _("Sales Person"),