Beispiel #1
0
 def test_amount(self):
     # Ref #727
     a = 192.65
     self.assertEqual(amount(a), 19265)
     a = 192.6555
     self.assertEqual(amount(a), 19266)
     self.assertEqual(amount(a, 4), 1926555)
Beispiel #2
0
 def test_amount(self):
     # Ref #727
     a = 192.65
     self.assertEqual(amount(a), 19265)
     a = 192.6555
     self.assertEqual(amount(a), 19266)
     self.assertEqual(amount(a, 4), 1926555)
Beispiel #3
0
    def deserialize(self, node, cstruct):
        if cstruct != 0 and not cstruct:
            return colander.null

        try:
            return amount(self.num(cstruct), self.precision)
        except Exception:
            raise colander.Invalid(
                node,
                u"\"{val}\" n'est pas un montant valide".format(val=cstruct))
    def deserialize(self, node, cstruct):
        if cstruct != 0 and not cstruct:
            return colander.null

        try:
            return amount(self.num(cstruct), self.precision)
        except Exception:
            raise colander.Invalid(
                node,
                u"\"{val}\" n'est pas un montant valide".format(val=cstruct)
            )
Beispiel #5
0
    def from_sale_product(cls, sale_product):
        """
        Build an instance based on the given sale_product

        :param obj sale_product: A SaleProduct instance
        :returns: A TaskLine instance
        """
        result = cls()
        result.description = sale_product.description
        result.cost = amount(sale_product.value, 5)
        result.tva = sale_product.tva
        result.unity = sale_product.unity
        result.quantity = 1
        return result
Beispiel #6
0
    def from_sale_product(cls, sale_product):
        """
        Build an instance based on the given sale_product

        :param obj sale_product: A SaleProduct instance
        :returns: A TaskLine instance
        """
        result = cls()
        result.description = sale_product.description
        result.cost = amount(sale_product.value, 5)
        result.tva = sale_product.tva
        result.unity = sale_product.unity
        result.quantity = 1
        result.product_id = sale_product.product_id
        return result