• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.comma_and函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中webnotes.utils.comma_and函数的典型用法代码示例。如果您正苦于以下问题:Python comma_and函数的具体用法?Python comma_and怎么用?Python comma_and使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: validate_exchange_rates_exist

	def validate_exchange_rates_exist(self):
		"""check if exchange rates exist for all Price List currencies (to company's currency)"""
		company_currency = webnotes.conn.get_value("Company", self.doc.company, "default_currency")
		if not company_currency:
			msgprint(_("Please specify currency in Company") + ": " + self.doc.company,
				raise_exception=ShoppingCartSetupError)
		
		price_list_currency_map = webnotes.conn.get_values("Price List", 
			[d.price_list for d in self.doclist.get({"parentfield": "price_lists"})],
			"currency")
		
		expected_to_exist = [currency + "-" + company_currency 
			for currency in price_list_currency_map.values()
			if currency != company_currency]
			
		if expected_to_exist:
			exists = webnotes.conn.sql_list("""select name from `tabCurrency Exchange`
				where name in (%s)""" % (", ".join(["%s"]*len(expected_to_exist)),),
				tuple(expected_to_exist))
		
			missing = list(set(expected_to_exist).difference(exists))
		
			if missing:
				msgprint(_("Missing Currency Exchange Rates for" + ": " + comma_and(missing)),
					raise_exception=ShoppingCartSetupError)
开发者ID:frank1638,项目名称:erpnext,代码行数:25,代码来源:shopping_cart_settings.py


示例2: get_data

def get_data(rows, company_abbr):
	start_row = 0
	data = []
	start_row_idx = 0
	for i in xrange(len(rows)):
		r = rows[i]
		if r[0]:
			if start_row and i >= start_row:
				if not start_row_idx: start_row_idx = i
				d, acc_dict = webnotes._dict(), webnotes._dict()
				for cidx in xrange(len(columns)):
					d[columns[cidx]] = r[cidx]
					
				if accounts:
					total_debit = total_credit = 0
					for acc_idx in xrange(len(accounts)):
						col_idx = len(columns) + acc_idx
						if flt(r[col_idx]) != 0:
							if not acc_dict.get(accounts[acc_idx]):
								acc_dict[accounts[acc_idx]] = 0
							acc_dict[accounts[acc_idx]] += flt(r[col_idx])
						if flt(r[col_idx]) > 0:
							total_debit += flt(r[col_idx])
						else:
							total_credit += abs(flt(r[col_idx]))
							
					d['total_debit'] = total_debit
					d['total_credit'] = total_credit
				
				data.append([d, acc_dict])
				

			if r[0]=="--------Data----------":
				start_row = i+2
				
				# check for empty columns
				empty_columns = [j+1 for j, c in enumerate(rows[i+1]) if not c]
				if empty_columns:
					raise Exception, """Column No(s). %s %s empty. \
						Please remove them and try again.""" % (comma_and(empty_columns),
						len(empty_columns)==1 and "is" or "are")

				columns = [c.replace(" ", "_").lower() for c in rows[i+1] 
					if not c.endswith(" - " + company_abbr)]
				accounts = [c for c in rows[i+1] if c.endswith(" - " + company_abbr)]

				if not accounts:
					webnotes.msgprint(_("""No Account found in csv file, 
						May be company abbreviation is not correct"""), raise_exception=1)

				if accounts and (len(columns) != rows[i+1].index(accounts[0])):
					webnotes.msgprint(_("""All account columns should be after \
						standard columns and on the right.
						If you entered it properly, next probable reason \
						could be wrong account name.
						Please rectify it in the file and try again."""), raise_exception=1)
				
	return data, start_row_idx
开发者ID:bindscha,项目名称:erpnext-fork,代码行数:58,代码来源:voucher_import_tool.py


示例3: _get_item_code

def _get_item_code(barcode):
	item_code = webnotes.conn.sql_list("""select name from `tabItem` where barcode=%s""", barcode)
			
	if not item_code:
		msgprint(_("No Item found with Barcode") + ": %s" % barcode, raise_exception=True)
	
	elif len(item_code) > 1:
		msgprint(_("Items") + " %s " % comma_and(item_code) + 
			_("have the same Barcode") + " %s" % barcode, raise_exception=True)
	
	return item_code[0]
开发者ID:jitendralive,项目名称:erpnext,代码行数:11,代码来源:utils.py


示例4: validate_recurring_invoice

	def validate_recurring_invoice(self):
		if self.doc.convert_into_recurring_invoice:
			self.validate_notification_email_id()
		
			if not self.doc.recurring_type:
				msgprint(_("Please select: ") + self.meta.get_label("recurring_type"),
				raise_exception=1)
		
			elif not (self.doc.invoice_period_from_date and \
					self.doc.invoice_period_to_date):
				msgprint(comma_and([self.meta.get_label("invoice_period_from_date"),
					self.meta.get_label("invoice_period_to_date")])
					+ _(": Mandatory for a Recurring Invoice."),
					raise_exception=True)
开发者ID:masums,项目名称:erpnext,代码行数:14,代码来源:sales_invoice.py


示例5: validate_overlapping_territories

	def validate_overlapping_territories(self, parentfield, fieldname):
		# for displaying message
		doctype = self.meta.get_field(parentfield).options
		
		# specify atleast one entry in the table
		self.validate_table_has_rows(parentfield, raise_exception=ShoppingCartSetupError)
		
		territory_name_map = self.get_territory_name_map(parentfield, fieldname)
		for territory, names in territory_name_map.items():
			if len(names) > 1:
				msgprint(_("Error for") + " " + _(doctype) + ": " + comma_and(names) +
					" " + _("have a common territory") + ": " + territory,
					raise_exception=ShoppingCartSetupError)
					
		return territory_name_map
开发者ID:frank1638,项目名称:erpnext,代码行数:15,代码来源:shopping_cart_settings.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.comma_or函数代码示例发布时间:2022-05-26
下一篇:
Python utils.cint函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap