-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: patch to migrate from checkbox to select
- Loading branch information
1 parent
7aed903
commit 57d8ed2
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
erpnext/patches/v15_0/migrate_checkbox_to_select_for_reconciliation_effect.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')""" | ||
) |