Skip to content

Commit 11eebdd

Browse files
fix: get totals of gross profit amount on call of the method get_invoiced_item_gross_margin
1 parent a9e9efb commit 11eebdd

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

erpnext/accounts/report/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def get_appropriate_company(filters):
137137
return company
138138

139139
@frappe.whitelist()
140-
def get_invoiced_item_gross_margin(sales_invoice=None, item_code=None, company=None):
140+
def get_invoiced_item_gross_margin(sales_invoice=None, item_code=None, company=None, with_item_data=False):
141141
from erpnext.accounts.report.gross_profit.gross_profit import GrossProfitGenerator
142142

143143
sales_invoice = sales_invoice or frappe.form_dict.get('sales_invoice')
@@ -152,5 +152,8 @@ def get_invoiced_item_gross_margin(sales_invoice=None, item_code=None, company=N
152152
}
153153

154154
gross_profit_data = GrossProfitGenerator(filters)
155+
result = gross_profit_data.grouped_data
156+
if not with_item_data:
157+
result = sum([d.gross_profit for d in result])
155158

156-
return gross_profit_data.grouped_data
159+
return result

0 commit comments

Comments
 (0)