Skip to content

Commit

Permalink
fix(gross profit): incorrect valuation rate on different warehouses
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Jul 15, 2024
1 parent b17696a commit f9d2dd0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions erpnext/accounts/report/gross_profit/gross_profit.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,8 @@ def get_buying_amount_from_so_dn(self, sales_order, so_detail, item_code):

def get_average_buying_rate(self, row, item_code):
args = row
if item_code not in self.average_buying_rate:
key = (item_code, row.warehouse)
if key not in self.average_buying_rate:
args.update(
{
"voucher_type": row.parenttype,
Expand All @@ -727,9 +728,9 @@ def get_average_buying_rate(self, row, item_code):
args.update({"serial_and_batch_bundle": row.serial_and_batch_bundle})

average_buying_rate = get_incoming_rate(args)
self.average_buying_rate[item_code] = flt(average_buying_rate)
self.average_buying_rate[key] = flt(average_buying_rate)

return self.average_buying_rate[item_code]
return self.average_buying_rate[key]

def get_last_purchase_rate(self, item_code, row):
purchase_invoice = frappe.qb.DocType("Purchase Invoice")
Expand Down

0 comments on commit f9d2dd0

Please sign in to comment.