fix: avg. buying amount for product bundle item with serial and batch no in gross profit report

(cherry picked from commit cc3f4bb0b0)
This commit is contained in:
ljain112
2024-12-16 16:20:36 +05:30
committed by Mergify
parent 4e23e3191d
commit 2edb6f3224

View File

@@ -637,6 +637,7 @@ class GrossProfitGenerator:
packed_item_row = row.copy() packed_item_row = row.copy()
packed_item_row.warehouse = packed_item.warehouse packed_item_row.warehouse = packed_item.warehouse
packed_item_row.qty = packed_item.total_qty * -1 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) buying_amount += self.get_buying_amount(packed_item_row, packed_item.item_code)
return flt(buying_amount, self.currency_precision) return flt(buying_amount, self.currency_precision)
@@ -728,6 +729,7 @@ class GrossProfitGenerator:
"voucher_no": row.parent, "voucher_no": row.parent,
"allow_zero_valuation": True, "allow_zero_valuation": True,
"company": self.filters.company, "company": self.filters.company,
"item_code": item_code,
} }
) )
@@ -997,6 +999,7 @@ class GrossProfitGenerator:
"is_return": row.is_return, "is_return": row.is_return,
"cost_center": row.cost_center, "cost_center": row.cost_center,
"invoice": row.parent, "invoice": row.parent,
"serial_and_batch_bundle": row.serial_and_batch_bundle,
} }
) )
@@ -1048,6 +1051,7 @@ class GrossProfitGenerator:
pki.rate, pki.rate,
(pki.rate * pki.qty).as_("base_amount"), (pki.rate * pki.qty).as_("base_amount"),
pki.parent_detail_docname, pki.parent_detail_docname,
pki.serial_and_batch_bundle,
) )
.where(pki.docstatus == 1) .where(pki.docstatus == 1)
) )