2020-11-09 06:59:03 +00:00
|
|
|
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
|
|
|
|
# MIT License. See license.txt
|
|
|
|
|
2021-09-02 11:14:59 +00:00
|
|
|
|
2020-11-09 06:59:03 +00:00
|
|
|
import frappe
|
2021-01-20 17:52:08 +00:00
|
|
|
from frappe.model.utils.rename_field import rename_field
|
2020-11-09 06:59:03 +00:00
|
|
|
|
2021-09-02 11:14:59 +00:00
|
|
|
|
2020-11-09 06:59:03 +00:00
|
|
|
def execute():
|
|
|
|
"""add value to email_id column from email"""
|
2021-01-20 17:52:08 +00:00
|
|
|
|
2020-11-09 06:59:03 +00:00
|
|
|
if frappe.db.has_column("Member", "email"):
|
|
|
|
# Get all members
|
|
|
|
for member in frappe.db.get_all("Member", pluck="name"):
|
|
|
|
# Check if email_id already exists
|
|
|
|
if not frappe.db.get_value("Member", member, "email_id"):
|
|
|
|
# fetch email id from the user linked field email
|
|
|
|
email = frappe.db.get_value("Member", member, "email")
|
|
|
|
|
|
|
|
# Set the value for it
|
|
|
|
frappe.db.set_value("Member", member, "email_id", email)
|
2021-01-20 17:52:08 +00:00
|
|
|
|
2021-01-21 07:53:59 +00:00
|
|
|
if frappe.db.exists("DocType", "Membership Settings"):
|
|
|
|
rename_field("Membership Settings", "enable_auto_invoicing", "enable_invoicing")
|