Skip to content

Commit

Permalink
fix: avg. buying amount for product bundle item with serial and batch…
Browse files Browse the repository at this point in the history
… no in gross profit report

(cherry picked from commit cc3f4bb)
  • Loading branch information
ljain112 authored and mergify[bot] committed Dec 23, 2024
1 parent 4e23e31 commit 2edb6f3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions erpnext/accounts/report/gross_profit/gross_profit.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ def get_buying_amount_from_product_bundle(self, row, product_bundle):
packed_item_row = row.copy()
packed_item_row.warehouse = packed_item.warehouse
packed_item_row.qty = packed_item.total_qty * -1
packed_item_row.serial_and_batch_bundle = packed_item.serial_and_batch_bundle
buying_amount += self.get_buying_amount(packed_item_row, packed_item.item_code)

return flt(buying_amount, self.currency_precision)
Expand Down Expand Up @@ -728,6 +729,7 @@ def get_average_buying_rate(self, row, item_code):
"voucher_no": row.parent,
"allow_zero_valuation": True,
"company": self.filters.company,
"item_code": item_code,
}
)

Expand Down Expand Up @@ -997,6 +999,7 @@ def get_bundle_item_row(self, row, item):
"is_return": row.is_return,
"cost_center": row.cost_center,
"invoice": row.parent,
"serial_and_batch_bundle": row.serial_and_batch_bundle,
}
)

Expand Down Expand Up @@ -1048,6 +1051,7 @@ def load_product_bundle(self):
pki.rate,
(pki.rate * pki.qty).as_("base_amount"),
pki.parent_detail_docname,
pki.serial_and_batch_bundle,
)
.where(pki.docstatus == 1)
)
Expand Down

0 comments on commit 2edb6f3

Please sign in to comment.