Ejemplo n.º 1
0
 def __str__(self):
     text = super(Tax, self).__str__()
     if self.rate is not None:
         text += " ({})".format(format_percent(self.rate, digits=3))
     if self.amount is not None:
         text += " ({})".format(format_money(self.amount))
     return text
Ejemplo n.º 2
0
 def __str__(self):
     text = super(Tax, self).__str__()
     if self.rate is not None:
         text += " ({})".format(format_percent(self.rate, digits=3))
     if self.amount is not None:
         text += " ({})".format(format_money(self.amount))
     return text
Ejemplo n.º 3
0
def encode_line(line):
    return {
        "sku": line.sku,
        "text": line.text,
        "quantity": format_decimal(line.quantity, locale=get_current_babel_locale()),
        "unitPrice": format_money(line.base_unit_price.amount),
        "discountAmount": format_money(line.discount_amount.amount),
        "taxlessTotal": format_money(line.taxless_price.amount),
        "taxPercentage": format_percent(line.tax_rate, 2),
        "taxfulTotal": format_money(line.taxful_price.amount)
    }
Ejemplo n.º 4
0
def encode_line(line):
    return {
        "sku": line.sku,
        "text": line.text,
        "quantity": format_decimal(line.quantity, locale=get_current_babel_locale()),
        "unitPrice": format_money(line.base_unit_price.amount),
        "discountAmount": format_money(line.discount_amount.amount),
        "taxlessTotal": format_money(line.taxless_price.amount),
        "taxPercentage": format_percent(line.tax_rate, 2),
        "taxfulTotal": format_money(line.taxful_price.amount)
    }
Ejemplo n.º 5
0
def percent(value, ndigits=0):
    return format_percent(value, ndigits)
Ejemplo n.º 6
0
def percent(value, ndigits=3):
    return format_percent(value, ndigits)
Ejemplo n.º 7
0
def _format_rate(tax_rule):
    if tax_rule.rate is None:
        return ""
    return format_percent(tax_rule.rate, digits=3)
Ejemplo n.º 8
0
 def format_percentage(self, instance, *args, **kwargs):
     if not instance.discount_percentage:
         return ""
     return format_percent(instance.discount_percentage)
Ejemplo n.º 9
0
def _format_rate(tax_rule):
    if tax_rule.rate is None:
        return ""
    return format_percent(tax_rule.rate, digits=3)
Ejemplo n.º 10
0
 def format_percentage(self, instance, *args, **kwargs):
     if not instance.discount_percentage:
         return ""
     return format_percent(instance.discount_percentage)