Merge pull request #46614 from frappe/mergify/bp/version-15-hotfix/pr-46573

Fix set landed cost based on pi (backport #46573)
This commit is contained in:
rohitwaghchaure
2025-03-19 16:31:09 +05:30
committed by GitHub
3 changed files with 7 additions and 7 deletions

View File

@@ -397,7 +397,7 @@ erpnext.patches.v15_0.set_difference_amount_in_asset_value_adjustment
erpnext.patches.v14_0.update_posting_datetime
erpnext.stock.doctype.stock_ledger_entry.patches.ensure_sle_indexes
erpnext.patches.v15_0.update_query_report
erpnext.patches.v15_0.rename_field_from_rate_difference_to_amount_difference
erpnext.patches.v15_0.rename_field_from_rate_difference_to_amount_difference #2025-03-18
erpnext.patches.v15_0.recalculate_amount_difference_field
erpnext.patches.v15_0.rename_sla_fields #2025-03-12
erpnext.patches.v15_0.set_purchase_receipt_row_item_to_capitalization_stock_item

View File

@@ -27,11 +27,7 @@ def execute():
table.qty,
parent.conversion_rate,
)
.where(
(table.amount_difference_with_purchase_invoice != 0)
& (table.docstatus == 1)
& (parent.company == company)
)
.where((table.docstatus == 1) & (parent.company == company))
)
posting_date = "2024-04-01"
@@ -121,6 +117,7 @@ def get_billed_qty_against_purchase_receipt(pr_names):
frappe.qb.from_(table)
.select(table.pr_detail, Sum(table.qty).as_("qty"))
.where((table.pr_detail.isin(pr_names)) & (table.docstatus == 1))
.groupby(table.pr_detail)
)
invoice_data = query.run(as_list=1)

View File

@@ -1083,6 +1083,9 @@ def update_billing_percentage(pr_doc, update_modified=True, adjust_incoming_rate
total_amount, total_billed_amount = 0, 0
item_wise_returned_qty = get_item_wise_returned_qty(pr_doc)
if adjust_incoming_rate:
item_wise_billed_qty = get_billed_qty_against_purchase_receipt(pr_doc)
for item in pr_doc.items:
returned_qty = flt(item_wise_returned_qty.get(item.name))
returned_amount = flt(returned_qty) * flt(item.rate)
@@ -1102,7 +1105,6 @@ def update_billing_percentage(pr_doc, update_modified=True, adjust_incoming_rate
if adjust_incoming_rate:
adjusted_amt = 0.0
item_wise_billed_qty = get_billed_qty_against_purchase_receipt(pr_doc)
if (
item.billed_amt is not None
@@ -1134,6 +1136,7 @@ def get_billed_qty_against_purchase_receipt(pr_doc):
frappe.qb.from_(table)
.select(table.pr_detail, fn.Sum(table.qty).as_("qty"))
.where((table.pr_detail.isin(pr_names)) & (table.docstatus == 1))
.groupby(table.pr_detail)
)
invoice_data = query.run(as_list=1)