def ask_pass_update(): # update the sys defaults as to awaiting users from frappe.utils import set_default users = frappe.db.sql("""SELECT DISTINCT(parent) as user FROM `tabUser Email` WHERE awaiting_password = 1""", as_dict=True) password_list = [ user.get("user") for user in users ] set_default("email_user_password", u','.join(password_list))
def validate(self): """ update settings in defaults """ from frappe.model import default_fields from frappe.utils import set_default for key in self.doc.fields: if key not in default_fields: set_default(key, self.doc.fields[key])
def validate(self): """ update settings in defaults """ from frappe.model import default_fields from frappe.utils import set_default for key in self.meta.get_valid_columns(): if key not in default_fields: set_default(key, self.get(key))
def set_as_default(self): from frappe.utils import set_default if self.is_default: frappe.db.sql("update `tabLetter Head` set is_default=0 where name != %s", self.name) set_default('letter_head', self.name) # update control panel - so it loads new letter directly frappe.db.set_default("default_letter_head_content", self.content)
def set_as_default(self): from frappe.utils import set_default if self.is_default: frappe.db.sql( "update `tabLetter Head` set is_default=0 where name != %s", self.name) set_default('letter_head', self.name) # update control panel - so it loads new letter directly frappe.db.set_default("default_letter_head_content", self.content)
def ask_pass_update(): # update the sys defaults as to awaiting users from frappe.utils import set_default users = frappe.db.sql("""select DISTINCT(parent) from `tabUser Emails` where awaiting_password = 1""", as_list=1) password_list = [] for u in users: password_list.append(u[0]) set_default("email_user_password", u','.join(password_list))
def set_as_default(self): from frappe.utils import set_default if not self.is_default: if not frappe.db.sql("""select count(*) from `tabLetter Head` where ifnull(is_default,0)=1"""): self.is_default = 1 if self.is_default: frappe.db.sql("update `tabLetter Head` set is_default=0 where name != %s", self.name) set_default("letter_head", self.name) # update control panel - so it loads new letter directly frappe.db.set_default("default_letter_head_content", self.content)
def set_as_default(self): from frappe.utils import set_default if not self.is_default: if not frappe.db.sql( """select count(*) from `tabLetter Head` where ifnull(is_default,0)=1""" ): self.is_default = 1 if self.is_default: frappe.db.sql( "update `tabLetter Head` set is_default=0 where name != %s", self.name) set_default('letter_head', self.name) # update control panel - so it loads new letter directly frappe.db.set_default("default_letter_head_content", self.content)
def toggle_simplified_time_log(self): self.simplified_time_log = cint(self.simplified_time_log) set_default('fs_simplified_time_log', self.simplified_time_log) # Make Time log property setters to hide if self.simplified_time_log: make_property_setter("Time Log", "date_worked", "hidden", not self.simplified_time_log, "Check") make_property_setter("Time Log", "date_worked", "reqd", self.simplified_time_log, "Check") else: make_property_setter("Time Log", "date_worked", "reqd", self.simplified_time_log, "Check") make_property_setter("Time Log", "date_worked", "hidden", not self.simplified_time_log, "Check") make_property_setter("Time Log", "to_time", "hidden", self.simplified_time_log, "Check") make_property_setter("Time Log", "from_time", "hidden", self.simplified_time_log, "Check") make_property_setter("Time Log", "date_worked", "in_list_view", self.simplified_time_log, "Check")