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


Python Document.sf_name方法代码示例

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


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

示例1: generate_visiting_schedule

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import sf_name [as 别名]
        def generate_visiting_schedule(self,bb,s,a,k):
		j=0
		d = datetime.date.today()
		#n="delete from `tabSub Franchise Visiting Schedule` where region='"+cstr(self.doc.regions)+"' and visiting_date between '"+cstr(d)+"' and '"+cstr(bb)+"'"
		#webnotes.conn.sql(n)
		#webnotes.errprint(n)
                if self.doc.visiting_frequency=='Weekely':
                        m = 7
			j = 4 * cint(self.doc.frequency)
			#j=  5
                elif self.doc.visiting_frequency=='Forth Night':
			#webnotes.errprint("hellooo")
                        m = 15
			j = 2 * cint(self.doc.frequency)
                        #j= 2
                elif self.doc.visiting_frequency=='One Month':
                        m = 30
			j = 1 * cint(self.doc.frequency)
			#j=1
		#webnotes.errprint(j)
                list1 = []
		list1.append(self.doc.start_date)
		dt=self.doc.start_date
		#for j in range (0,j):
                #	date=add_days(getdate(dt),m)
		#	webnotes.errprint(date)
                #	if date <= bb:
                #       	list1.append(date)
		#	dt=date
		#webnotes.errprint(self.doc.start_date)
		#webnotes.errprint(bb)
		#webnotes.errprint(list1)
		webnotes.errprint(j)
		for j in range(0,j):
			#webnotes.errprint("hii")
                	for ls in s:
			        #webnotes.errprint("hello")
                        	for i in range(len(list1)):
					#webnotes.errprint(k)
					#webnotes.errprint(list1[i])
                               		d=Document('Sub Franchise Visiting Schedule')
                               		d.account_id=k
					#webnotes.errprint(d.account_id)
					d.region=self.doc.regions
					d.device_id=a
                               		d.sf_name=ls[0]
					#visiting_date=list1[i]
					d.save(new=1)
		return ("Welcome..")
开发者ID:saurabh6790,项目名称:pow-app,代码行数:51,代码来源:franchise_visiting_schedule.py

示例2: on_update

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import sf_name [as 别名]
	def on_update(self):
		#res="select account_id from `tabFranchise` where region='"+self.doc.region+"'"
		#rs=webnotes.conn.sql(res)
        	#webnotes.errprint(rs)
		#self.doc.account_id=rs[0][0]
		#webnotes.errprint(self.doc.account_id)
		#self.doc.save()
                s=webnotes.conn.sql("select customer_name from `tabCustomer` where territory='"+cstr(self.doc.region)+"' and name='"+self.doc.name+"'")
                #webnotes.errprint(s)
                if not s:
                        d = Document('Customer')
                        d.customer_name=self.doc.sf_name
                        d.territory=self.doc.region
                        d.account_id=self.doc.account_id
                        d.sf_name=self.doc.sf_name
                        d.customer_type='Company'
                        d.customer_group='Commercial'
开发者ID:gangadhar-kadam,项目名称:powapp,代码行数:19,代码来源:sub_franchise.py

示例3: schedule

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import sf_name [as 别名]
def schedule(_type='POST'):
	regn=webnotes.conn.sql("select name from `tabFranchise Visiting Schedule` where name in (select distinct region from `tabFranchise`) and name in (select distinct region from `tabSub Franchise`)",as_list=1)
	webnotes.errprint(regn)
	for r in regn:
		details=webnotes.conn.sql("select visiting_frequency,frequency,start_date from `tabFranchise Visiting Schedule` where name='"+r[0]+"'",as_list=1)
		k=webnotes.conn.sql("select account_id from `tabFranchise` where region='"+r[0]+"'",as_list=1)
		s=webnotes.conn.sql("select sf_name from `tabSub Franchise` where region='"+r[0]+"'",as_list=1)
		bb=get_last_day(details[0][2])
		j=0
		from webnotes.utils import nowdate
		dd = nowdate()
		if details[0][0]=='Weekly':
			m = 4
			j = m * cint(details[0][1])
		elif details[0][0]=='Fortnightly':
			m = 2
			j = m * cint(details[0][1])
		elif details[0][0]=='Monthly':
			m = 1
			j = m * cint(details[0][1])
		list1 = []
		list1.append(details[0][2])
		dt=details[0][2]
		for j in range(0,j):
			for ls in s:
				for i in range(len(list1)):
					d=Document('Sub Franchise Visiting Schedule')
					d.account_id=k[0][0]
					d.region=r[0]
					d.sf_name=ls[0]
					if details[0][0]=='Weekly':
						d.weekly=details[0][1]
					elif details[0][0]=='Fortnightly':
						d.forth_nightly=details[0][1]
					elif details[0][0]=='Monthly':
						d.monthly=details[0][1]
					d.save()
					webnotes.conn.commit()
	webnotes.errprint("Done")
开发者ID:gangadhar-kadam,项目名称:powapp,代码行数:41,代码来源:franchise_visiting_schedule.py

示例4: generate_visiting_schedule

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import sf_name [as 别名]
	def generate_visiting_schedule(self,bb,s,a,k):
		j=0
		d = datetime.date.today()
	        if self.doc.visiting_frequency=='Weekely':
		        m = 7
			j = 4 * cint(self.doc.frequency)
	       	elif self.doc.visiting_frequency=='Fortnightly':
	       	        m = 15
			j = 2 * cint(self.doc.frequency)
	       	elif self.doc.visiting_frequency=='Monthly':
	       	        m = 30
			j = 1 * cint(self.doc.frequency)
	       	list1 = []
		list1.append(self.doc.start_date)
		dt=self.doc.start_date
		#webnotes.errprint(j)
		for j in range(0,j):
	               	for ls in s:
	                       	for i in range(len(list1)):
					#webnotes.errprint("generation")
	                       		d=Document('Sub Franchise Visiting Schedule')
	                       		d.account_id=k
					d.region=self.doc.regions
					d.device_id=a
	                       		d.sf_name=ls[0]
					if self.doc.visiting_frequency=='Weekely':
						#webnotes.errprint("Weekely")
						d.weekly=self.doc.frequency
					elif self.doc.visiting_frequency=='Fortnightly':
                				#webnotes.errprint("Fortnightly")
 						d.forth_nightly=self.doc.frequency
					elif self.doc.visiting_frequency=='Monthly':
						#webnotes.errprint("Monthly")
						d.monthly=self.doc.frequency
					d.save(new=1)
		return ("Welcome..")
开发者ID:gangadhar-kadam,项目名称:powapp,代码行数:38,代码来源:franchise_visiting_schedule.py

示例5: create_customer1

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import sf_name [as 别名]
def create_customer1(auth_key,name,mobile_number,email_id,datetime,version,_type='POST'):
        login =[]
        loginObj = {}
        qr="select name from `tabauth keys` where auth_key="+auth_key
        res=webnotes.conn.sql(qr)
        if res:
                qr1="select name from `tabCustomer Details` where customer_name="+name+" and phone_number="+mobile_number
                rs=webnotes.conn.sql(qr1)
                if rs :
                        key={}
                        key['customer_id']=rs[0][0]
                        login.append(key)
                        loginObj['status']='200'
                        loginObj['customer']=login

                        return loginObj
                else :
                        from webnotes.model.doc import Document
                        d = Document('Customer Details')
                        if len(name)>3:
                                d.customer_name=name[1:-1]
                        if len(email_id)>3:
                                d.customer_email=email_id[1:-1]
                        if len(mobile_number)>3:
                                d.phone_number=mobile_number[1:-1]
                        d.save()
                        d1 = Document('Customer')
                        d1.customer_name=name[1:-1]+'-'+mobile_number[1:-1]
			d1.territory=''
			d1.account_id=''
                        d1.sf_name=''
			d1.customer_type='Company'
			d1.customer_group='Commercial'
                        d1.company='PowerCap'
                        d1.save(new=1)
			if cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")):
                          if not webnotes.conn.get_value("Account", {"master_type": "Customer","master_name": d1.name}) and not 		webnotes.conn.get_value("Account", {"master_name": d1.name}):
                                if not webnotes.conn.get_value("Stock Ledger Entry", {"Warehouse": d1.name}):
                                                ac_bean = webnotes.bean({
                                                	"doctype": "Account",
	                                                'account_name': d1.name,
	                                                'parent_account': "Accounts Receivable - P",
	                                                'group_or_ledger':'Ledger',
							'debit_or_credit':'Debit',
	                                                'company':"PowerCap",
	                                                "master_type": "Customer",
	                                                "master_name": d1.name,
							"freeze_account": "No"
                                        	})
                                        	ac_bean.ignore_permissions = True
                                        	ac_bean.insert()
                        webnotes.conn.commit()
                        key={}
                        key['customer_id']=d.name
                        login.append(key)
                        loginObj['status']='200'
                        loginObj['customer']=login
                        return loginObj
        else:
                loginObj['status']='401'
                return loginObj
开发者ID:gangadhar-kadam,项目名称:powapp,代码行数:63,代码来源:__init__.py

示例6: create_subfranchise1

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import sf_name [as 别名]
def create_subfranchise1(auth_key,name,address,map_location,mobile_number,email_id,datetime,version,_type='POST'):
        login =[]
        loginObj = {}
        if len(auth_key[1:-1])<=0 or len(name[1:-1])<=0 or len(address[1:-1])<=0:
                loginObj['status']='401'
                loginObj['error']='Incomplete data to create sub- franchise, Please provide token no,name and address'
                return loginObj
        qr="select name from `tabauth keys` where auth_key="+auth_key
        res=webnotes.conn.sql(qr)
        if res:
          zz=webnotes.conn.sql("select name from `tabSub Franchise` where name='"+name[1:-1]+"'")
          if zz:
                key={}
                key['subfranchise_id']=zz and zz[0][0] or ''
                login.append(key)
                loginObj['status']='200'
                loginObj['subfranchise']=login
                return loginObj

          else:
                str='sent '
                from webnotes.utils.email_lib import sendmail
                import json,requests
                url="http://maps.googleapis.com/maps/api/geocode/json?address="+address+"&sensor=true"
                #return url
                #webnotes.errprint(url)
                r = requests.get(url)
                data = json.loads(r.text)
                #return data
                e=''
                sts=data['status']
                if sts=='OK':
                        a=data['results']
                        b=a[0]
                        c=b['geometry']
                        e=c['location']
                rig="select region from `tabFranchise` where contact_email='"+res[0][0]+"' order by creation desc limit 1"
                rgn=webnotes.conn.sql(rig)
                from webnotes.model.doc import Document
                d = Document('Sub Franchise')
                d.sf_name=name[1:-1]
                d.creation=datetime[1:-1]
                d.region=rgn and rgn[0][0] or ''
                d.address=address[1:-1]
                if len(e)>1:
                        d.lat=e['lat']
                        d.lon=e['lng']
                if len(email_id)>3:
                        d.email=email_id[1:-1]
                if len(mobile_number)>3:
                        d.c_number=mobile_number[1:-1]
                d.save()
        	d1 = Document('Customer')
                d1.customer_name=name[1:-1]+'-'+mobile_number[1:-1]
		d1.territory=''
		d1.account_id=''
                d1.sf_name=''
		d1.customer_type='Company'
		d1.customer_group='Commercial'
                d1.company='PowerCap'
                d1.save(new=1)
		if cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")):
                   if not webnotes.conn.get_value("Account", {"master_type": "Customer","master_name": d1.name}) and not webnotes.conn.get_value("Account", {"master_name": d1.name}):
                         if not webnotes.conn.get_value("Stock Ledger Entry", {"Warehouse": d1.name}):
                                ac_bean = webnotes.bean({
                                       	"doctype": "Account",
                                        'account_name': d1.name,
                                        'parent_account': "Accounts Receivable - P",
                                        'group_or_ledger':'Ledger',
					'debit_or_credit':'Debit',
                                        'company':"PowerCap",
                                        "master_type": "Customer",
                                        "master_name": d1.name,
					"freeze_account": "No"
                               	})
                               	ac_bean.ignore_permissions = True
                               	ac_bean.insert()
		webnotes.conn.commit()
                key={}
                key['subfranchise_id']=d.name
                login.append(key)
                loginObj['status']='200'
                loginObj['subfranchise']=login
                return loginObj
        else:
                loginObj['status']='401'
                return loginObj
开发者ID:gangadhar-kadam,项目名称:powapp,代码行数:89,代码来源:__init__.py

示例7: create_subfranchise

# 需要导入模块: from webnotes.model.doc import Document [as 别名]
# 或者: from webnotes.model.doc.Document import sf_name [as 别名]
def create_subfranchise(auth_key,name,address,map_location,mobile_number,email_id,datetime,version,_type='POST'):
	login =[]
	loginObj = {}
	if len(auth_key[1:-1])<=0 or len(name[1:-1])<=0 or len(address[1:-1])<=0:
		loginObj['status']='401'
		loginObj['error']='Incomplete data to create sub- franchise, Please provide token no,name and address'
		return loginObj	
	qr="select name from `tabauth keys` where auth_key="+auth_key
	res=webnotes.conn.sql(qr)
	if res:
          zz=webnotes.conn.sql("select name from `tabSub Franchise` where name='"+name[1:-1]+"'")
	  if zz:
                key={}
                key['subfranchise_id']=zz and zz[0][0] or ''
                login.append(key)
                loginObj['status']='200'
                loginObj['subfranchise']=login
                return loginObj
           
          else:
	        str='sent '
	        from webnotes.utils.email_lib import sendmail
	        import json,requests
	        url="http://maps.googleapis.com/maps/api/geocode/json?address="+address+"&sensor=true"
	        #return url
	        #webnotes.errprint(url)
	        r = requests.get(url)
	        data = json.loads(r.text)
	        #return data
	        e=''
	        sts=data['status']
		if sts=='OK':
			a=data['results']
		        b=a[0]
		        c=b['geometry']
		        e=c['location']


		rig="select region from `tabFranchise` where contact_email='"+res[0][0]+"' order by creation desc limit 1"
		rgn=webnotes.conn.sql(rig)
		from webnotes.model.doc import Document
		d = Document('Sub Franchise')
		d.sf_name=name[1:-1]
		d.creation=datetime[1:-1]
		d.region=rgn and rgn[0][0] or ''
		d.address=address[1:-1]
		if len(e)>1:
			d.lat=e['lat']
			d.lon=e['lng']
		if len(email_id)>3:
			d.email=email_id[1:-1]
		if len(mobile_number)>3:
			d.c_number=mobile_number[1:-1]
		d.save()
		key={}
		key['subfranchise_id']=d.name
		login.append(key)
		loginObj['status']='200'
		loginObj['subfranchise']=login
		return loginObj
	else:
		loginObj['status']='401'
		return loginObj
开发者ID:gangadhar-kadam,项目名称:powapp,代码行数:65,代码来源:__init__.py


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