本文整理汇总了Python中trytond.pool.Pool.round方法的典型用法代码示例。如果您正苦于以下问题:Python Pool.round方法的具体用法?Python Pool.round怎么用?Python Pool.round使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trytond.pool.Pool
的用法示例。
在下文中一共展示了Pool.round方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_total_amount
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import round [as 别名]
def get_total_amount(self, ids, name):
currency_obj = Pool().get('currency.currency')
res = {}
for invoice in self.browse(ids):
if not invoice.service_fee:
invoice.service_fee = Decimal('0.0')
if not invoice.discount:
invoice.discount = Decimal('0.0')
res[invoice.id] = currency_obj.round(invoice.currency,
invoice.untaxed_amount + invoice.tax_amount + invoice.service_fee - invoice.discount)
return res
示例2: _on_change_lines_taxes
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import round [as 别名]
def _on_change_lines_taxes(self, vals):
res = super(HealthInvoice, self)._on_change_lines_taxes(vals)
currency_obj = Pool().get('currency.currency')
currency = None
if vals.get('currency'):
currency = currency_obj.browse(vals['currency'])
res['discount'] = vals.get('discount', Decimal('0.0'))
res['service_fee'] = vals.get('service_fee', Decimal('0.0'))
res['total_amount'] = currency_obj.round(currency,
res['untaxed_amount'] + res['tax_amount'] + res['service_fee'] - res['discount'])
return res
示例3: compute_quantity
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import round [as 别名]
def compute_quantity(self, factor):
Uom = Pool().get("product.uom")
return Uom.round(self.quantity * factor, self.uom.rounding)
示例4: calcular_total
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import round [as 别名]
def calcular_total(self, sale, cantidad, utilidad):
Currency = Pool().get('currency.currency')
gastos = self._calcular_gastos(sale, cantidad, lambda x: True)
return Currency.round(sale.currency, gastos * (100 + utilidad) / 100)