fix: get totals of gross profit amount on call of the method get_invoiced_item_gross_margin
This commit is contained in:
parent
1d6f2c3b5d
commit
7bee502d72
@ -137,7 +137,7 @@ def get_appropriate_company(filters):
|
|||||||
return company
|
return company
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_invoiced_item_gross_margin(sales_invoice=None, item_code=None, company=None):
|
def get_invoiced_item_gross_margin(sales_invoice=None, item_code=None, company=None, with_item_data=False):
|
||||||
from erpnext.accounts.report.gross_profit.gross_profit import GrossProfitGenerator
|
from erpnext.accounts.report.gross_profit.gross_profit import GrossProfitGenerator
|
||||||
|
|
||||||
sales_invoice = sales_invoice or frappe.form_dict.get('sales_invoice')
|
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
|
|||||||
}
|
}
|
||||||
|
|
||||||
gross_profit_data = GrossProfitGenerator(filters)
|
gross_profit_data = GrossProfitGenerator(filters)
|
||||||
|
result = gross_profit_data.grouped_data
|
||||||
|
if not with_item_data:
|
||||||
|
result = sum([d.gross_profit for d in result])
|
||||||
|
|
||||||
return gross_profit_data.grouped_data
|
return result
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user