From 6e563438bd2c5ef187cb86c38b3340db44ab62c6 Mon Sep 17 00:00:00 2001 From: ljain112 Date: Mon, 25 Nov 2024 18:45:17 +0530 Subject: [PATCH] fix: gp for return invoice (cherry picked from commit 00403515a8ba005e5ac5c0e7a5ff88a5bda5b170) --- erpnext/accounts/report/gross_profit/gross_profit.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py index ff7d77e2e01..edc0ecbd581 100644 --- a/erpnext/accounts/report/gross_profit/gross_profit.py +++ b/erpnext/accounts/report/gross_profit/gross_profit.py @@ -507,11 +507,16 @@ class GrossProfitGenerator: if returned_item_row.qty != 0: if row.qty >= abs(returned_item_row.qty): row.qty += returned_item_row.qty + row.base_amount += flt(returned_item_row.base_amount, self.currency_precision) returned_item_row.qty = 0 + returned_item_row.base_amount = 0 + else: row.qty = 0 + row.base_amount = 0 returned_item_row.qty += row.qty - row.base_amount += flt(returned_item_row.base_amount, self.currency_precision) + returned_item_row.base_amount += row.base_amount + row.buying_amount = flt(flt(row.qty) * flt(row.buying_rate), self.currency_precision) def get_average_rate_based_on_group_by(self):