Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import frappe
- def execute():
- mapping = {
- "High": "4 (High)",
- "Medium": "3 (Normal)",
- "Low": "2 (Low)"
- }
- query = "select name, priority from `tabToDo` where priority is not null;"
- res = frappe.db.sql(query, as_dict=True)
- for todo in res:
- new_priority = mapping.get(todo['priority'], False)
- if new_priority:
- frappe.db.set_value('ToDo', todo['name'], 'priority', new_priority)
- frappe.db.commit()
- query = "select name, subject, reference_type, reference_name from `tabToDo` where subject is null and reference_type is not null and reference_name is not null;"
- res = frappe.db.sql(query, as_dict=True)
- for todo in res:
- new_subject = f"{todo['reference_type']} - {todo['reference_name']}"
- frappe.db.set_value('ToDo', todo['name'], 'subject', new_subject)
- frappe.db.commit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement