fix: correct buying amount for product bundel
(cherry picked from commit 4e6a5893e7)
This commit is contained in:
@@ -617,6 +617,7 @@ class GrossProfitGenerator:
|
|||||||
if packed_item.get("parent_detail_docname") == row.item_row:
|
if packed_item.get("parent_detail_docname") == row.item_row:
|
||||||
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
|
||||||
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)
|
||||||
@@ -649,7 +650,9 @@ class GrossProfitGenerator:
|
|||||||
else:
|
else:
|
||||||
my_sle = self.get_stock_ledger_entries(item_code, row.warehouse)
|
my_sle = self.get_stock_ledger_entries(item_code, row.warehouse)
|
||||||
if (row.update_stock or row.dn_detail) and my_sle:
|
if (row.update_stock or row.dn_detail) and my_sle:
|
||||||
parenttype, parent = row.parenttype, row.parent
|
parenttype = row.parenttype
|
||||||
|
parent = row.invoice or row.parent
|
||||||
|
|
||||||
if row.dn_detail:
|
if row.dn_detail:
|
||||||
parenttype, parent = "Delivery Note", row.delivery_note
|
parenttype, parent = "Delivery Note", row.delivery_note
|
||||||
|
|
||||||
@@ -909,30 +912,33 @@ class GrossProfitGenerator:
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_bundle_item_row(self, product_bundle, item):
|
def get_bundle_item_row(self, row, item):
|
||||||
return frappe._dict(
|
return frappe._dict(
|
||||||
{
|
{
|
||||||
"parent_invoice": product_bundle.item_code,
|
"parent_invoice": row.item_code,
|
||||||
"indent": product_bundle.indent + 1,
|
"parenttype": row.parenttype,
|
||||||
|
"indent": row.indent + 1,
|
||||||
"parent": None,
|
"parent": None,
|
||||||
"invoice_or_item": item.item_code,
|
"invoice_or_item": item.item_code,
|
||||||
"posting_date": product_bundle.posting_date,
|
"posting_date": row.posting_date,
|
||||||
"posting_time": product_bundle.posting_time,
|
"posting_time": row.posting_time,
|
||||||
"project": product_bundle.project,
|
"project": row.project,
|
||||||
"customer": product_bundle.customer,
|
"customer": row.customer,
|
||||||
"customer_group": product_bundle.customer_group,
|
"customer_group": row.customer_group,
|
||||||
"item_code": item.item_code,
|
"item_code": item.item_code,
|
||||||
"item_name": item.item_name,
|
"item_name": item.item_name,
|
||||||
"description": item.description,
|
"description": item.description,
|
||||||
"warehouse": product_bundle.warehouse,
|
"warehouse": item.warehouse or row.warehouse,
|
||||||
|
"update_stock": row.update_stock,
|
||||||
"item_group": "",
|
"item_group": "",
|
||||||
"brand": "",
|
"brand": "",
|
||||||
"dn_detail": product_bundle.dn_detail,
|
"dn_detail": row.dn_detail,
|
||||||
"delivery_note": product_bundle.delivery_note,
|
"delivery_note": row.delivery_note,
|
||||||
"qty": item.total_qty * -1,
|
"qty": item.total_qty * -1,
|
||||||
"item_row": None,
|
"item_row": row.item_row,
|
||||||
"is_return": product_bundle.is_return,
|
"is_return": row.is_return,
|
||||||
"cost_center": product_bundle.cost_center,
|
"cost_center": row.cost_center,
|
||||||
|
"invoice": row.parent,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user