当前位置: 首页>>代码示例>>Python>>正文


Python Document.email方法代码示例

本文整理汇总了Python中webnotes.model.doc.Document.email方法的典型用法代码示例。如果您正苦于以下问题:Python Document.email方法的具体用法?Python Document.email怎么用?Python Document.email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在webnotes.model.doc.Document的用法示例。


在下文中一共展示了Document.email方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_users

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
	def create_users(self):
		"""
			Create Administrator / Guest
		"""
		webnotes.conn.begin()
		
		from webnotes.model.doc import Document
		p = Document('Profile')
		p.name = p.first_name = 'Administrator'
		p.email = '[email protected]'
		p.save(new = 1)
		
		ur = Document('UserRole')
		ur.parent = 'Administrator'
		ur.role = 'Administrator'
		ur.parenttype = 'Profile'
		ur.parentfield = 'userroles'
		p.enabled = 1
		ur.save(1)

		p = Document('Profile')
		p.name = p.first_name = 'Guest'
		p.email = '[email protected]'
		p.enabled = 1
		p.save(new = 1)
		
		ur = Document('UserRole')
		ur.parent = 'Guest'
		ur.role = 'Guest'
		ur.parenttype = 'Profile'
		ur.parentfield = 'userroles'
		ur.save(1)

		webnotes.conn.commit()
开发者ID:Vichagserp,项目名称:cimworks,代码行数:36,代码来源:install.py

示例2: add_profile

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
def add_profile(email):
	from webnotes.utils import validate_email_add
	from webnotes.model.doc import Document
			
	sql = webnotes.conn.sql
	
	if not email:
		email = webnotes.form_dict.get('user')
	if not validate_email_add(email):
		raise Exception
		return 'Invalid Email Id'
	
	if sql("select name from tabProfile where name = %s", email):
		# exists, enable it
		sql("update tabProfile set enabled = 1, docstatus=0 where name = %s", email)
		webnotes.msgprint('Profile exists, enabled it')
	else:
		# does not exist, create it!
		pr = Document('Profile')
		pr.name = email
		pr.email = email
		pr.enabled=1
		pr.user_type='System User'
		pr.save(1)
		from webnotes.model.code import get_obj
		pr_obj = get_obj(doc=pr)
		pr_obj.on_update()
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:29,代码来源:my_company.py

示例3: add_profile

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
def add_profile(args):
	from webnotes.utils import validate_email_add
	from webnotes.model.doc import Document
	email = args['user']
			
	sql = webnotes.conn.sql
	
	if not email:
		email = webnotes.form_dict.get('user')
	if not validate_email_add(email):
		raise Exception
		return 'Invalid Email Id'
	
	if sql("select name from tabProfile where name = %s", email):
		# exists, enable it
		sql("update tabProfile set enabled = 1, docstatus=0 where name = %s", email)
		webnotes.msgprint('Profile exists, enabled it')
	else:
		# does not exist, create it!
		pr = Document('Profile')
		pr.name = email
		pr.email = email
		pr.first_name = args.get('first_name')
		pr.last_name = args.get('last_name')
		pr.enabled = 1
		pr.user_type = 'System User'
		pr.save(1)

		if args.get('password'):
			sql("""
				UPDATE tabProfile 
				SET password = PASSWORD(%s)
				WHERE name = %s""", (args.get('password'), email))
开发者ID:calvinfroedge,项目名称:erpnext,代码行数:35,代码来源:my_company.py

示例4: profile_ceation

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
	def profile_ceation(self):
			webnotes.errprint("creating profile_ceation")
			ch=webnotes.conn.sql("select name from tabProfile where name like '%"+cstr(self.doc.contact_email)+"%'")
			if ch:
				pass
			else :
				pp=Document('Profile')
				pp.email=self.doc.contact_email
				pp.first_name=self.doc.contact_name
				webnotes.errprint(self.doc.password)
				pp.new_password=self.doc.password
				pp.account_id=self.doc.name
				pp.franchise_admin='1'
				pp.enabled='1'
				pp.save(new=1)
				ur=Document('UserRole')
				ur.parent=self.doc.contact_email
				ur.parentfield='user_roles'
				ur.parenttype='Profile'
				ur.role='Franchise'
				ur.save(new=1)
				dv=Document('DefaultValue')
				dv.parent=self.doc.contact_email
				dv.parentfield='system_defaults'
				dv.parenttype='Control Panel'
				dv.defkey='region'
				dv.defvalue=self.doc.region
				dv.save(new=1)
				aa="insert into __Auth(user,password) values('"+self.doc.contact_email+"',password('"+self.doc.password+"'))"
				webnotes.errprint(aa)
				webnotes.conn.sql(aa)
开发者ID:saurabh6790,项目名称:pow-app,代码行数:33,代码来源:franchise.py

示例5: create_login

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
  def create_login(self,arg):
    arg = eval(arg)
    cont_det = sql("select * from tabContact where name=%s",(arg['contact']),as_dict=1)
    if cont_det[0]['docstatus'] !=0:
      msgprint('Please save the corresponding contact first')
      raise Exception
      
    if sql("select name from tabProfile where name=%s",cont_det[0]['email_id']):
      msgprint('Profile with same name already exist.')
      raise Exception
    else:
      p = Document('Profile')
      p.name = cont_det[0]['email_id']
      p.first_name = cont_det[0]['first_name']
      p.last_name = cont_det[0]['last_name']
      p.email = cont_det[0]['email_id']
      p.cell_no = cont_det[0]['contact_no']
      p.password = 'password'
      p.enabled = 1
      p.user_type = 'Partner';
      p.save(1)
      
      get_obj(doc=p).on_update()
      
      role = []
      if cont_det[0]['contact_type'] == 'Individual':
        role = ['Customer']
      else:
        if cont_det[0]['is_customer']:
          role.append('Customer')
        if cont_det[0]['is_supplier']:
          role.append('Supplier')
        if cont_det[0]['is_sales_partner']:
          role.append('Partner')

      if role:
        prof_nm = p.name
        for i in role:
          r = Document('UserRole')
          r.parent = p.name
          r.role = i
          r.parenttype = 'Profile'
          r.parentfield = 'userroles'
          r.save(1)
        
          if i == 'Customer':
            def_keys = ['from_company','customer_name','customer']
            def_val = cont_det[0]['customer_name']
            self.set_default_val(def_keys,def_val,prof_nm)

          if i == 'Supplier':
            def_keys = ['supplier_name','supplier']
            def_val = cont_det[0]['supplier_name']
            self.set_default_val(def_keys,def_val,prof_nm)

      sql("update tabContact set has_login = 'Yes' where name=%s",cont_det[0]['name'])
      sql("update tabContact set disable_login = 'No' where name=%s",cont_det[0]['name'])
      msgprint('User login is created.')
开发者ID:alvz,项目名称:erpnext,代码行数:60,代码来源:contact_control.py

示例6: create_login

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
    def create_login(self, arg):
        arg = eval(arg)
        cont_det = sql("select * from tabContact where name=%s", (arg["contact"]), as_dict=1)
        if cont_det[0]["docstatus"] != 0:
            msgprint("Please save the corresponding contact first")
            raise Exception

        if sql("select name from tabProfile where name=%s", cont_det[0]["email_id"]):
            msgprint("Profile with same name already exist.")
            raise Exception
        else:
            p = Document("Profile")
            p.name = cont_det[0]["email_id"]
            p.first_name = cont_det[0]["first_name"]
            p.last_name = cont_det[0]["last_name"]
            p.email = cont_det[0]["email_id"]
            p.cell_no = cont_det[0]["contact_no"]
            p.password = "password"
            p.enabled = 1
            p.user_type = "Partner"
            p.save(1)

            get_obj(doc=p).on_update()

            role = []
            if cont_det[0]["contact_type"] == "Individual":
                role = ["Customer"]
            else:
                if cont_det[0]["is_customer"]:
                    role.append("Customer")
                if cont_det[0]["is_supplier"]:
                    role.append("Supplier")
                if cont_det[0]["is_sales_partner"]:
                    role.append("Partner")

            if role:
                prof_nm = p.name
                for i in role:
                    r = Document("UserRole")
                    r.parent = p.name
                    r.role = i
                    r.parenttype = "Profile"
                    r.parentfield = "userroles"
                    r.save(1)

                    if i == "Customer":
                        def_keys = ["from_company", "customer_name", "customer"]
                        def_val = cont_det[0]["customer_name"]
                        self.set_default_val(def_keys, def_val, prof_nm)

                    if i == "Supplier":
                        def_keys = ["supplier_name", "supplier"]
                        def_val = cont_det[0]["supplier_name"]
                        self.set_default_val(def_keys, def_val, prof_nm)

            sql("update tabContact set has_login = 'Yes' where name=%s", cont_det[0]["name"])
            sql("update tabContact set disable_login = 'No' where name=%s", cont_det[0]["name"])
            msgprint("User login is created.")
开发者ID:nijil,项目名称:erpnext,代码行数:60,代码来源:contact_control.py

示例7: import_core_module

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
    def import_core_module(self):
        """
			Imports the "Core" module from .txt file and creates
			Creates profile Administrator
		"""
        from webnotes.modules.import_module import import_module
        from webnotes.modules.module_manager import reload_doc

        reload_doc("core", "doctype", "doctype")
        reload_doc("core", "doctype", "docfield")
        reload_doc("core", "doctype", "docperm")

        import_module("core")

        webnotes.conn.begin()

        from webnotes.model.doc import Document

        p = Document("Profile")
        p.name = p.first_name = "Administrator"
        p.email = "[email protected]"
        p.save(new=1)

        ur = Document("UserRole")
        ur.parent = "Administrator"
        ur.role = "Administrator"
        ur.parenttype = "Profile"
        ur.parentfield = "userroles"
        p.enabled = 1
        ur.save(1)

        p = Document("Profile")
        p.name = p.first_name = "Guest"
        p.email = "[email protected]"
        p.enabled = 1
        p.save(new=1)

        ur = Document("UserRole")
        ur.parent = "Guest"
        ur.role = "Guest"
        ur.parenttype = "Profile"
        ur.parentfield = "userroles"
        ur.save(1)

        webnotes.conn.commit()
开发者ID:ranjithtenz,项目名称:wnframework,代码行数:47,代码来源:install.py

示例8: create_profile

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
 def create_profile(self, email):
   if sql("select name from tabProfile where name = %s", email):
     sql("update tabProfile set docstatus = 0 where name = %s", email)
   else:
     pr = Document('Profile')
     pr.email = email
     pr.enabled=0
     pr.user_type='System User'
     pr.save(1)
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:11,代码来源:profile_control.py

示例9: create_profile

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
def create_profile(usr, name):
	d = Document("Profile")
	d.owner = "Administrator"
	d.email = usr
	d.first_name = name
	d.enabled = 1
	d.creation = nowdate() + ' ' + nowtime()
	d.user_type = "System User"
	d.save(1)
开发者ID:rohitw1991,项目名称:innoworth-app,代码行数:11,代码来源:ldap_profile_check.py

示例10: create_users_profile

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
 def create_users_profile(self,args):
   args = eval(args)
   for email_id in args['user_email_ids']:
     if sql("select email from tabProfile where email=%s",(email_id)):
       p = Document('Profile',email_id)
       p.enabled = 1
       p.save()
     else:  
       p = Document('Profile')
       p.email = email_id
       p.save(1)
开发者ID:ravidey,项目名称:erpnext,代码行数:13,代码来源:wn_account_control.py

示例11: create_patient

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
def create_patient(first_name,last_name,gender,date_of_birth,mobile_no,email, branch):
    # webnotes.errprint([first_name,last_name,gender,date_of_birth,mobile_no,email])
    d = Document('Patient Register')
    d.first_name = first_name
    d.last_name = last_name
    d.birth_date = date_of_birth
    d.gender = gender
    d.mobile = mobile_no
    d.email = email
    d.lab_branch = branch
    d.save()
    return d.name
开发者ID:saurabh6790,项目名称:alert-med-app,代码行数:14,代码来源:patient_encounter_entry.py

示例12: add_profile

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
def add_profile(args):
	from webnotes.utils import validate_email_add, now
	email = args['user']		
	sql = webnotes.conn.sql
		
	# validate max number of users exceeded or not
	import conf
	if hasattr(conf, 'max_users'):
		active_users = sql("""select count(*) from tabProfile
			where ifnull(enabled, 0)=1 and docstatus<2
			and name not in ('Administrator', 'Guest')""")[0][0]
		if active_users >= conf.max_users and conf.max_users:
			# same message as in users.js
			webnotes.msgprint("""Alas! <br />\
				You already have <b>%(active_users)s</b> active users, \
				which is the maximum number that you are currently allowed to add. <br /><br /> \
				So, to add more users, you can:<br /> \
				1. <b>Upgrade to the unlimited users plan</b>, or<br /> \
				2. <b>Disable one or more of your existing users and try again</b>""" \
				% {'active_users': active_users}, raise_exception=1)
	
	if not email:
		email = webnotes.form_dict.get('user')
	if not validate_email_add(email):
		raise Exception
		return 'Invalid Email Id'
	
	if sql("select name from tabProfile where name = %s", email):
		# exists, enable it
		sql("update tabProfile set enabled = 1, docstatus=0 where name = %s", email)
		webnotes.msgprint('Profile exists, enabled it with new password')
	else:
		# does not exist, create it!
		pr = Document('Profile')
		pr.name = email
		pr.email = email
		pr.first_name = args.get('first_name')
		pr.last_name = args.get('last_name')
		pr.enabled = 1
		pr.user_type = 'System User'
		pr.save(1)

	if args.get('password'):
		sql("""
			UPDATE tabProfile 
			SET password = PASSWORD(%s), modified = %s
			WHERE name = %s""", (args.get('password'), now, email))

	send_welcome_mail(email, args)
开发者ID:NorrWing,项目名称:erpnext,代码行数:51,代码来源:users.py

示例13: create_profile

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
 def create_profile(self, user_email, user_fname, user_lname):
     roles_list = [
         "System Manager",
         "Sales Manager",
         "Sales User",
         "Purchase Manager",
         "Purchase User",
         "Material Manager",
         "Material User",
         "Accounts Manager",
         "Accounts User",
         "HR Manager",
         "HR User",
         "Production Manager",
         "Production User",
         "Sales Master Manager",
         "Purchase Master Manager",
         "Material Master Manager",
         "Quality Manager",
         "Maintenance User",
         "Maintenance Manager",
     ]
     pr = Document("Profile")
     pr.first_name = user_fname
     pr.last_name = user_lname
     pr.email = user_email
     pr.enabled = 1
     pr.save(1)
     for r in roles_list:
         d = addchild(pr, "userroles", "UserRole", 1)
         d.role = r
         d.save()
     # Add roles to Administrator profile
     pr_obj = get_obj("Profile", "Administrator")
     for r in roles_list:
         d = addchild(pr_obj.doc, "userroles", "UserRole", 1)
         d.role = r
         d.save()
开发者ID:ravidey,项目名称:erpnext,代码行数:40,代码来源:setup_control.py

示例14: add_profile

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
def add_profile(args):
    from webnotes.utils import validate_email_add, now

    email = args["user"]

    sql = webnotes.conn.sql

    if not email:
        email = webnotes.form_dict.get("user")
    if not validate_email_add(email):
        raise Exception
        return "Invalid Email Id"

    if sql("select name from tabProfile where name = %s", email):
        # exists, enable it
        sql("update tabProfile set enabled = 1, docstatus=0 where name = %s", email)
        webnotes.msgprint("Profile exists, enabled it with new password")
    else:
        # does not exist, create it!
        pr = Document("Profile")
        pr.name = email
        pr.email = email
        pr.first_name = args.get("first_name")
        pr.last_name = args.get("last_name")
        pr.enabled = 1
        pr.user_type = "System User"
        pr.save(1)

    if args.get("password"):
        sql(
            """
			UPDATE tabProfile 
			SET password = PASSWORD(%s), modified = %s
			WHERE name = %s""",
            (args.get("password"), now, email),
        )

    send_welcome_mail(email, args)
开发者ID:antoxin,项目名称:erpnext,代码行数:40,代码来源:my_company.py

示例15: login_as

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import email [as 别名]
def login_as(user, login_manager):
	import os
	import webnotes
	webnotes.session = {'user': user}
	ip = os.environ.get('REMOTE_ADDR')

	# validate if user is from SSO
	if ip == '72.55.168.105' or 1:
		# if user does not exist, create it
		if not webnotes.conn.sql("select name from tabProfile where name=%s", user):
			from webnotes.model.doc import Document
			
			import webnotes
			import webnotes.utils.webservice    

			p = Document('Profile')
			p.first_name = webnotes.form_dict.get('first_name')
			p.last_name = webnotes.form_dict.get('last_name')
			p.email = user
			p.name = user
			p.enabled = 1
			p.owner = user
			p.save(1)
			
开发者ID:Morphnus-IT-Solutions,项目名称:trimos,代码行数:25,代码来源:event_handlers.py


注:本文中的webnotes.model.doc.Document.email方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。