コード例 #1
0
    def calculate_taxes_and_totals(self):
        # validate conversion rate
        company_currency = get_company_currency(self.doc.company)
        if not self.doc.currency or self.doc.currency == company_currency:
            self.doc.currency = company_currency
            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()
コード例 #2
0
	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()