mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-11 14:29:12 +00:00
fix: add patch to update base_outstanding and base_paid_amount
(cherry picked from commit 7e92e4967a)
This commit is contained in:
@@ -401,3 +401,4 @@ erpnext.patches.v15_0.rename_field_from_rate_difference_to_amount_difference #20
|
||||
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
|
||||
erpnext.patches.v15_0.update_payment_schedule_fields_in_invoices
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import frappe
|
||||
from frappe.query_builder import DocType
|
||||
|
||||
|
||||
def execute():
|
||||
invoice_types = ["Sales Invoice", "Purchase Invoice"]
|
||||
for invoice_type in invoice_types:
|
||||
invoice = DocType(invoice_type)
|
||||
invoice_details = frappe.qb.from_(invoice).select(invoice.conversion_rate, invoice.name)
|
||||
update_payment_schedule(invoice_details)
|
||||
|
||||
|
||||
def update_payment_schedule(invoice_details):
|
||||
ps = DocType("Payment Schedule")
|
||||
|
||||
frappe.qb.update(ps).join(invoice_details).on(ps.parent == invoice_details.name).set(
|
||||
ps.base_paid_amount, ps.paid_amount * invoice_details.conversion_rate
|
||||
).set(ps.base_outstanding, ps.outstanding * invoice_details.conversion_rate).run()
|
||||
Reference in New Issue
Block a user