Esempio n. 1
0
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))
Esempio n. 2
0
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))
Esempio n. 3
0
    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])
Esempio n. 4
0
	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))
Esempio n. 5
0
	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)
Esempio n. 6
0
    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)
Esempio n. 7
0
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))
Esempio n. 8
0
    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)
Esempio n. 9
0
    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)
Esempio n. 10
0
	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")