File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -401,3 +401,4 @@ erpnext.patches.v15_0.rename_field_from_rate_difference_to_amount_difference #20
401401erpnext.patches.v15_0.recalculate_amount_difference_field
402402erpnext.patches.v15_0.rename_sla_fields #2025-03-12
403403erpnext.patches.v15_0.set_purchase_receipt_row_item_to_capitalization_stock_item
404+ erpnext.patches.v15_0.update_payment_schedule_fields_in_invoices
Original file line number Diff line number Diff line change 1+ import frappe
2+ from frappe .query_builder import DocType
3+
4+
5+ def execute ():
6+ invoice_types = ["Sales Invoice" , "Purchase Invoice" ]
7+ for invoice_type in invoice_types :
8+ invoice = DocType (invoice_type )
9+ invoice_details = frappe .qb .from_ (invoice ).select (invoice .conversion_rate , invoice .name )
10+ update_payment_schedule (invoice_details )
11+
12+
13+ def update_payment_schedule (invoice_details ):
14+ ps = DocType ("Payment Schedule" )
15+
16+ frappe .qb .update (ps ).join (invoice_details ).on (ps .parent == invoice_details .name ).set (
17+ ps .base_paid_amount , ps .paid_amount * invoice_details .conversion_rate
18+ ).set (ps .base_outstanding , ps .outstanding * invoice_details .conversion_rate ).run ()
You can’t perform that action at this time.
0 commit comments