File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -408,3 +408,4 @@ erpnext.patches.v15_0.rename_sla_fields
408408erpnext.stock.doctype.stock_ledger_entry.patches.ensure_sle_indexes
409409erpnext.patches.v15_0.update_query_report
410410erpnext.patches.v15_0.set_purchase_receipt_row_item_to_capitalization_stock_item
411+ 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