Skip to content

Commit

Permalink
refactor: patch to migrate from checkbox to select
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Jan 9, 2025
1 parent 7aed903 commit 57d8ed2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -394,4 +394,5 @@ erpnext.patches.v14_0.update_stock_uom_in_work_order_item
erpnext.patches.v15_0.enable_allow_existing_serial_no
erpnext.patches.v15_0.update_cc_in_process_statement_of_accounts
erpnext.patches.v15_0.refactor_closing_stock_balance #5
erpnext.patches.v15_0.update_asset_status_to_work_in_progress
erpnext.patches.v15_0.update_asset_status_to_work_in_progress
erpnext.patches.v15_0.migrate_checkbox_to_select_for_reconciliation_effect
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import frappe


def execute():
"""
'reconcile_on_advance_payment_date' has been renamed to 'reconciliation_takes_effect_on' and converted to a Select fields
Checbox value of above fields are converted to select in both company master and Payment Entry
"""
companies = frappe.db.get_all("Company", fields=["name", "reconciliation_takes_effect_on"])
for x in companies:
new_value = (
"Advance Payment Date" if x.reconciliation_takes_effect_on else "Oldest Of Invoice Or Advance"
)
frappe.db.set_value("Company", x.name, "reconciliation_takes_effect_on", new_value)

frappe.db.sql(
"""update `tabPayment Entry` set advance_payment_reconciliation_takes_effect_on = if(advance_payment_reconciliation_takes_effect_on = 0, 'Oldest Of Invoice Or Advance', 'Advance Payment Date')"""
)

0 comments on commit 57d8ed2

Please sign in to comment.