Found bug at Gross Profit Report

i found some bug at Gross Profit Report when my Sales Invoice have returned with UOM Conversion.
example :
i create sales invoice with item
qty : 3
UOM : Ton
Stock UOM Kg, UOM Conversion 1000
Stock Qty : 3000 Kg

and then i make sales return,
qty : -1
UOM : Ton
Stock UOM kg, UOM Conversion 1000
Stock Qty : -1000 Kg

when i see at Gross Profit Report, the report show my Qty : 2999

after i check the code at Gross Profit, i found this query line 189

returned_invoices = frappe.db.sql(“”"
select, si_item.item_code, si_item.qty, si_item.base_amount, si.return_against
tabSales Invoice si, tabSales Invoice Item si_item
where = si_item.parent
and si.docstatus = 1
and si.is_return = 1
“”", as_dict=1)

i change the query from si_item.qty to si_item.stock_qty as qty and si.base_amount to si_item.base_net_amount as base_amount

and it fixed.

i found this bug at ERPNEXT ver 10 and 11.0.3-beta.32 () (staging)

1 Like

Please add your bug report and fix of github Issues · frappe/erpnext · GitHub.

As well include a link to this thread there and add a link to your issue here thanks

1 Like