mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-18 00:48:42 +00:00
fix: gross profit calculation with rate adjustment entries
(cherry picked from commit b9f330a158)
This commit is contained in:
@@ -562,7 +562,12 @@ class GrossProfitGenerator:
|
|||||||
row.base_amount = packed_item.base_amount
|
row.base_amount = packed_item.base_amount
|
||||||
|
|
||||||
# get buying amount
|
# get buying amount
|
||||||
if row.item_code in product_bundles:
|
if row.is_debit_note:
|
||||||
|
# Rate adjustment debit notes have no stock movement, so buying amount is zero
|
||||||
|
if not grouped_by_invoice:
|
||||||
|
row.qty = 0
|
||||||
|
row.buying_amount = 0
|
||||||
|
elif row.item_code in product_bundles:
|
||||||
row.buying_amount = flt(
|
row.buying_amount = flt(
|
||||||
self.get_buying_amount_from_product_bundle(row, product_bundles[row.item_code]),
|
self.get_buying_amount_from_product_bundle(row, product_bundles[row.item_code]),
|
||||||
self.currency_precision,
|
self.currency_precision,
|
||||||
@@ -951,6 +956,7 @@ class GrossProfitGenerator:
|
|||||||
SalesInvoice.customer_group,
|
SalesInvoice.customer_group,
|
||||||
SalesInvoice.customer_name,
|
SalesInvoice.customer_name,
|
||||||
SalesInvoice.territory,
|
SalesInvoice.territory,
|
||||||
|
SalesInvoice.is_debit_note,
|
||||||
SalesInvoiceItem.item_code,
|
SalesInvoiceItem.item_code,
|
||||||
SalesInvoice.base_net_total.as_("invoice_base_net_total"),
|
SalesInvoice.base_net_total.as_("invoice_base_net_total"),
|
||||||
SalesInvoiceItem.item_name,
|
SalesInvoiceItem.item_name,
|
||||||
@@ -1131,6 +1137,7 @@ class GrossProfitGenerator:
|
|||||||
"posting_time": row.posting_time,
|
"posting_time": row.posting_time,
|
||||||
"project": row.project,
|
"project": row.project,
|
||||||
"update_stock": row.update_stock,
|
"update_stock": row.update_stock,
|
||||||
|
"is_debit_note": row.is_debit_note,
|
||||||
"customer": row.customer,
|
"customer": row.customer,
|
||||||
"customer_group": row.customer_group,
|
"customer_group": row.customer_group,
|
||||||
"customer_name": row.customer_name,
|
"customer_name": row.customer_name,
|
||||||
@@ -1169,6 +1176,7 @@ class GrossProfitGenerator:
|
|||||||
"description": item.description,
|
"description": item.description,
|
||||||
"warehouse": item.warehouse or row.warehouse,
|
"warehouse": item.warehouse or row.warehouse,
|
||||||
"update_stock": row.update_stock,
|
"update_stock": row.update_stock,
|
||||||
|
"is_debit_note": row.is_debit_note,
|
||||||
"item_group": "",
|
"item_group": "",
|
||||||
"brand": "",
|
"brand": "",
|
||||||
"dn_detail": row.dn_detail,
|
"dn_detail": row.dn_detail,
|
||||||
|
|||||||
Reference in New Issue
Block a user