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


Python utils.get_company_currency函数代码示例

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


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

示例1: get_appr_user_role

	def get_appr_user_role(self, det, doctype_name, total, based_on, condition, item, company):
		amt_list, appr_users, appr_roles = [], [], []
		users, roles = '',''
		if det:
			for x in det:
				amt_list.append(flt(x[0]))
			max_amount = max(amt_list)
			
			app_dtl = sql("select approving_user, approving_role from `tabAuthorization Rule` where transaction = %s and (value = %s or value > %s) and docstatus != 2 and based_on = %s and company = %s %s" % ('%s', '%s', '%s', '%s', '%s', condition), (doctype_name, flt(max_amount), total, based_on, company))
			
			if not app_dtl:
				app_dtl = sql("select approving_user, approving_role from `tabAuthorization Rule` where transaction = %s and (value = %s or value > %s) and docstatus != 2 and based_on = %s and ifnull(company,'') = '' %s" % ('%s', '%s', '%s', '%s', condition), (doctype_name, flt(max_amount), total, based_on)) 
			for d in app_dtl:
				if(d[0]): appr_users.append(d[0])
				if(d[1]): appr_roles.append(d[1])
			
			if not has_common(appr_roles, webnotes.user.get_roles()) and not has_common(appr_users, [session['user']]):
				msg, add_msg = '',''
				if max_amount:
					dcc = get_company_currency(self.doc.company)
					if based_on == 'Grand Total': msg = "since Grand Total exceeds %s. %s" % (dcc, flt(max_amount))
					elif based_on == 'Itemwise Discount': msg = "since Discount exceeds %s for Item Code : %s" % (cstr(max_amount)+'%', item)
					elif based_on == 'Average Discount' or based_on == 'Customerwise Discount': msg = "since Discount exceeds %s" % (cstr(max_amount)+'%')
				
				if appr_users: add_msg = "Users : "+cstr(appr_users)
				if appr_roles: add_msg = "Roles : "+cstr(appr_roles)
				if appr_users and appr_roles: add_msg = "Users : "+cstr(appr_users)+" or "+"Roles : "+cstr(appr_roles)
				msgprint("You are not authorize to submit this %s %s. Please send for approval to %s" % (doctype_name, msg, add_msg))
				raise Exception
开发者ID:MiteshC,项目名称:erpnext,代码行数:29,代码来源:authorization_control.py

示例2: set_price_list_currency

	def set_price_list_currency(self, buying_or_selling):
		company_currency = get_company_currency(self.doc.company)
		fieldname = buying_or_selling.lower() + "_price_list"
		
		# TODO - change this, since price list now has only one currency allowed
		if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname):
			self.doc.fields.update(get_price_list_currency(self.doc.fields.get(fieldname)))
				
			if self.doc.price_list_currency:
				if self.doc.price_list_currency == company_currency:
					self.doc.plc_conversion_rate = 1.0
				elif not self.doc.plc_conversion_rate or \
						(flt(self.doc.plc_conversion_rate)==1 and company_currency!= self.doc.price_list_currency):
					exchange = self.doc.price_list_currency + "-" + company_currency
					self.doc.plc_conversion_rate = flt(webnotes.conn.get_value("Currency Exchange",
						exchange, "exchange_rate"))
					
				if not self.doc.currency:
					self.doc.currency = self.doc.price_list_currency
					self.doc.conversion_rate = self.doc.plc_conversion_rate
						
		if self.meta.get_field("currency"):
			if self.doc.currency and self.doc.currency != company_currency:
				if not self.doc.conversion_rate:
					exchange = self.doc.currency + "-" + company_currency
					self.doc.conversion_rate = flt(webnotes.conn.get_value("Currency Exchange",
						exchange, "exchange_rate"))
			else:
				self.doc.conversion_rate = 1
开发者ID:rajatkapoor,项目名称:erpnext,代码行数:29,代码来源:accounts_controller.py

示例3: set_price_list_currency

	def set_price_list_currency(self, buying_or_selling):
		if self.meta.get_field("currency"):
			company_currency = get_company_currency(self.doc.company)
			
			# price list part
			fieldname = "selling_price_list" if buying_or_selling.lower() == "selling" \
				else "buying_price_list"
			if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname):
				self.doc.price_list_currency = webnotes.conn.get_value("Price List",
					self.doc.fields.get(fieldname), "currency")
				
				if self.doc.price_list_currency == company_currency:
					self.doc.plc_conversion_rate = 1.0

				elif not self.doc.plc_conversion_rate:
					self.doc.plc_conversion_rate = self.get_exchange_rate(
						self.doc.price_list_currency, company_currency)
			
			# currency
			if not self.doc.currency:
				self.doc.currency = self.doc.price_list_currency
				self.doc.conversion_rate = self.doc.plc_conversion_rate
			elif self.doc.currency == company_currency:
				self.doc.conversion_rate = 1.0
			elif not self.doc.conversion_rate:
				self.doc.conversion_rate = self.get_exchange_rate(self.doc.currency,
					company_currency)
开发者ID:Jdfkat,项目名称:erpnext,代码行数:27,代码来源:accounts_controller.py

示例4: check_conversion_rate

    def check_conversion_rate(self, obj):
        default_currency = get_company_currency(obj.doc.company)
        if not default_currency:
            msgprint("Message: Please enter default currency in Company Master")
            raise Exception
        if (
            (obj.doc.currency == default_currency and flt(obj.doc.conversion_rate) != 1.00)
            or not obj.doc.conversion_rate
            or (obj.doc.currency != default_currency and flt(obj.doc.conversion_rate) == 1.00)
        ):
            msgprint(
                "Please Enter Appropriate Conversion Rate for Customer's Currency to Base Currency (%s --> %s)"
                % (obj.doc.currency, default_currency),
                raise_exception=1,
            )

        if (
            (obj.doc.price_list_currency == default_currency and flt(obj.doc.plc_conversion_rate) != 1.00)
            or not obj.doc.plc_conversion_rate
            or (obj.doc.price_list_currency != default_currency and flt(obj.doc.plc_conversion_rate) == 1.00)
        ):
            msgprint(
                "Please Enter Appropriate Conversion Rate for Price List Currency to Base Currency ( (%s --> %s)"
                % (obj.doc.price_list_currency, default_currency),
                raise_exception=1,
            )
开发者ID:soerenhb,项目名称:erpnext,代码行数:26,代码来源:sales_common.py

示例5: set_price_list_currency

	def set_price_list_currency(self, buying_or_selling):
		company_currency = get_company_currency(self.doc.company)
		# TODO - change this, since price list now has only one currency allowed
		if self.meta.get_field("price_list_name") and self.doc.price_list_name and \
			not self.doc.price_list_currency:
				self.doc.fields.update(get_price_list_currency(self.doc.price_list_name))
				
				if self.doc.price_list_currency:
					if not self.doc.plc_conversion_rate:
						if self.doc.price_list_currency == company_currency:
							self.doc.plc_conversion_rate = 1.0
						else:
							exchange = self.doc.price_list_currency + "-" + company_currency
							self.doc.plc_conversion_rate = flt(webnotes.conn.get_value("Currency Exchange",
								exchange, "exchange_rate"))
						
					if not self.doc.currency:
						self.doc.currency = self.doc.price_list_currency
						self.doc.conversion_rate = self.doc.plc_conversion_rate
						
		if self.meta.get_field("currency") and self.doc.currency != company_currency and \
			not self.doc.conversion_rate:
				exchange = self.doc.currency + "-" + company_currency
				self.doc.conversion_rate = flt(webnotes.conn.get_value("Currency Exchange",
					exchange, "exchange_rate"))
开发者ID:antaryaami,项目名称:erpnext,代码行数:25,代码来源:accounts_controller.py

示例6: check_conversion_rate

	def check_conversion_rate(self):
		default_currency = get_company_currency(self.doc.company)		
		if not default_currency:
			msgprint('Message: Please enter default currency in Company Master')
			raise Exception
		if (self.doc.currency == default_currency and flt(self.doc.conversion_rate) != 1.00) or not self.doc.conversion_rate or (self.doc.currency != default_currency and flt(self.doc.conversion_rate) == 1.00):
			msgprint("Message: Please Enter Appropriate Conversion Rate.")
			raise Exception				
开发者ID:alnguyenngoc,项目名称:erpnext,代码行数:8,代码来源:purchase_invoice.py

示例7: set_total_in_words

	def set_total_in_words(self):
		from webnotes.utils import money_in_words
		company_currency = get_company_currency(self.doc.company)
		if self.meta.get_field("in_words"):
			self.doc.in_words = money_in_words(self.doc.grand_total, company_currency)
		if self.meta.get_field("in_words_import"):
			self.doc.in_words_import = money_in_words(self.doc.grand_total_import,
		 		self.doc.currency)
开发者ID:PhamThoTam,项目名称:erpnext,代码行数:8,代码来源:buying_controller.py

示例8: validate

	def validate(self):		
		if self.meta.get_field("currency"):
			self.company_currency = get_company_currency(self.doc.company)
			self.validate_conversion_rate("currency", "conversion_rate")
			
			if self.doc.price_list_name and self.doc.price_list_currency:
				self.validate_conversion_rate("price_list_currency", "plc_conversion_rate")
				
			# set total in words
			self.set_total_in_words()
开发者ID:robertbecht,项目名称:erpnext,代码行数:10,代码来源:buying_controller.py

示例9: set_total_in_words

	def set_total_in_words(self):
		from webnotes.utils import money_in_words
		company_currency = get_company_currency(self.doc.company)
		
		disable_rounded_total = cint(webnotes.conn.get_value("Global Defaults", None, 
			"disable_rounded_total"))
			
		if self.meta.get_field("in_words"):
			self.doc.in_words = money_in_words(disable_rounded_total and 
				self.doc.grand_total or self.doc.rounded_total, company_currency)
		if self.meta.get_field("in_words_export"):
			self.doc.in_words_export = money_in_words(disable_rounded_total and 
				self.doc.grand_total_export or self.doc.rounded_total_export, self.doc.currency)
开发者ID:Jdfkat,项目名称:erpnext,代码行数:13,代码来源:selling_controller.py

示例10: validate

	def validate(self):		
		if self.meta.get_field("currency"):
			self.company_currency = get_company_currency(self.doc.company)
			self.validate_conversion_rate("currency", "conversion_rate")
			
			if self.doc.price_list_name and self.doc.price_list_currency:
				self.validate_conversion_rate("price_list_currency", "plc_conversion_rate")
			
			# IMPORTANT: enable this only when client side code is similar to this one
			# self.calculate_taxes_and_totals()
			
			# set total in words
			self.set_total_in_words()
开发者ID:leondai78,项目名称:erpnext,代码行数:13,代码来源:buying_controller.py

示例11: validate

	def validate(self):
		from webnotes.utils import money_in_words
		self.check_existing()
		
		if not (len(self.doclist.get({"parentfield": "earning_details"})) or 
			len(self.doclist.get({"parentfield": "deduction_details"}))):
				self.get_emp_and_leave_details()
		else:
			self.get_leave_details(self.doc.leave_without_pay)

		if not self.doc.net_pay:
			self.calculate_net_pay()
			
		company_currency = get_company_currency(self.doc.company)
		self.doc.total_in_words = money_in_words(self.doc.rounded_total, company_currency)
开发者ID:Tejal011089,项目名称:med2-app,代码行数:15,代码来源:salary_slip.py

示例12: set_print_format_fields

	def set_print_format_fields(self):
		for d in getlist(self.doclist, 'entries'):
			#msgprint(self.doc.company)
			chk_type = sql("select master_type, account_type from `tabAccount` where name='%s'" % d.account)
			master_type, acc_type = chk_type and cstr(chk_type[0][0]) or '', chk_type and cstr(chk_type[0][1]) or ''
			if master_type in ['Supplier', 'Customer']:
				if not self.doc.pay_to_recd_from:
					self.doc.pay_to_recd_from = webnotes.conn.get_value(master_type, ' - '.join(d.account.split(' - ')[:-1]), master_type == 'Customer' and 'customer_name' or 'supplier_name')
			
			if acc_type == 'Bank or Cash':
				company_currency = get_company_currency(self.doc.company)
				amt = flt(d.debit) and d.debit or d.credit	
				self.doc.total_amount = company_currency +' '+ cstr(amt)
				from webnotes.utils import money_in_words
				self.doc.total_amount_in_words = money_in_words(amt, company_currency)
开发者ID:MiteshC,项目名称:erpnext,代码行数:15,代码来源:journal_voucher.py

示例13: validate

	def validate(self):
		super(BuyingController, self).validate()
		self.validate_stock_or_nonstock_items()
		self.validate_warehouse_belongs_to_company()
		if self.meta.get_field("currency"):
			self.company_currency = get_company_currency(self.doc.company)
			self.validate_conversion_rate("currency", "conversion_rate")
			
			if self.doc.price_list_name and self.doc.price_list_currency:
				self.validate_conversion_rate("price_list_currency", "plc_conversion_rate")
			
			# IMPORTANT: enable this only when client side code is similar to this one
			# self.calculate_taxes_and_totals()
						
			# set total in words
			self.set_total_in_words()
开发者ID:alnguyenngoc,项目名称:erpnext,代码行数:16,代码来源:buying_controller.py

示例14: set_print_format_fields

	def set_print_format_fields(self):
		for d in getlist(self.doclist, 'entries'):
			account_type, master_type = webnotes.conn.get_value("Account", d.account, 
				["account_type", "master_type"])
				
			if master_type in ['Supplier', 'Customer']:
				if not self.doc.pay_to_recd_from:
					self.doc.pay_to_recd_from = webnotes.conn.get_value(master_type, 
						' - '.join(d.account.split(' - ')[:-1]), 
						master_type == 'Customer' and 'customer_name' or 'supplier_name')
			
			if account_type == 'Bank or Cash':
				company_currency = get_company_currency(self.doc.company)
				amt = flt(d.debit) and d.debit or d.credit	
				self.doc.total_amount = company_currency +' '+ cstr(amt)
				from webnotes.utils import money_in_words
				self.doc.total_amount_in_words = money_in_words(amt, company_currency)
开发者ID:cocoy,项目名称:erpnext,代码行数:17,代码来源:journal_voucher.py

示例15: calculate_taxes_and_totals

	def calculate_taxes_and_totals(self):
		# validate conversion rate
		if not self.doc.currency:
			self.doc.currency = get_company_currency(self.doc.company)
			self.doc.conversion_rate = 1.0
		else:
			validate_conversion_rate(self.doc.currency, self.doc.conversion_rate,
				self.meta.get_label("conversion_rate"), self.doc.company)
		
		self.doc.conversion_rate = flt(self.doc.conversion_rate)
		self.item_doclist = self.doclist.get({"parentfield": self.fname})
		self.tax_doclist = self.doclist.get({"parentfield": self.other_fname})
		
		self.calculate_item_values()
		self.initialize_taxes()
		
		if hasattr(self, "determine_exclusive_rate"):
			self.determine_exclusive_rate()
		
		self.calculate_net_total()
		self.calculate_taxes()
		self.calculate_totals()
		self._cleanup()
开发者ID:frank1638,项目名称:erpnext,代码行数:23,代码来源:accounts_controller.py


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