Beispiel #1
0
 def reference(self):
     return u"{0}/{1}".format(
         self.invoice.official_number,
         render_api.format_amount(
             self.payment.remittance_amount,
             grouping=False
         ),
     )
Beispiel #2
0
 def format_debit(debit):
     """
         Format the debit entry to get a clean float in our export
         12000 => 120,00
     """
     if debit == '':
         return 0
     else:
         return format_amount(debit, grouping=False)
Beispiel #3
0
 def format_debit(debit):
     """
         Format the debit entry to get a clean float in our export
         12000 => 120,00
     """
     if debit == '':
         return 0
     else:
         return format_amount(debit, grouping=False)
Beispiel #4
0
 def test_format_amount(self):
     a = 1525
     b = 1525.3
     locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
     self.assertEqual(render_api.format_amount(a), "15,25")
     self.assertEqual(render_api.format_amount(a, False), "15,25")
     self.assertEqual(render_api.format_amount(b), "15,25")
     self.assertEqual(render_api.format_amount(b, False), "15,253")
     c = 210000
     self.assertEqual(render_api.format_amount(c, grouping=False), "2100,00")
     self.assertEqual(render_api.format_amount(c, grouping=True), "2 100,00")
Beispiel #5
0
    def stream_columns(self, tva):
        """
        Stream the table datas for the given item
        :param obj tva: The Tva object to stream
        :returns: List of labels
        """
        if tva.default:
            default = u"<i class='glyphicon glyphicon-ok-sign'></i> \
Tva par défaut"
        else:
            default = ""
        return (
            tva.name,
            render_api.format_amount(tva.value),
            tva.compte_cg or u"Aucun",
            default,
        )
Beispiel #6
0
    def stream_columns(self, tva):
        """
        Stream the table datas for the given item
        :param obj tva: The Tva object to stream
        :returns: List of labels
        """
        if tva.default:
            default = u"<i class='glyphicon glyphicon-ok-sign'></i> \
Tva par défaut"
        else:
            default = ""
        return (
            tva.name,
            render_api.format_amount(tva.value),
            tva.compte_cg or u"Aucun",
            default,
        )
Beispiel #7
0
 def test_format_amount(self):
     a = 1525
     b = 1525.3
     locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
     self.assertEqual(render_api.format_amount(a), "15,25")
     self.assertEqual(render_api.format_amount(a, False), "15,25")
     self.assertEqual(render_api.format_amount(b), "15,25")
     self.assertEqual(render_api.format_amount(b, False), "15,253")
     c = 210000
     self.assertEqual(render_api.format_amount(c, grouping=False),
                      "2100,00")
     self.assertEqual(render_api.format_amount(c, grouping=True),
                      "2&nbsp;100,00")
Beispiel #8
0
    def test_format_amount(self):
        a = 1525
        b = 1525.3
        locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
        self.assertEqual(render_api.format_amount(a), "15,25")
        self.assertEqual(render_api.format_amount(a, trim=False), "15,25")

        self.assertEqual(render_api.format_amount(b), "15,25")
        self.assertEqual(render_api.format_amount(b, trim=False), "15,25")

        c = 210000
        self.assertEqual(
            render_api.format_amount(c, grouping=False),
            "2100,00"
        )
        self.assertEqual(
            render_api.format_amount(c, grouping=True),
            "2&nbsp;100,00"
        )

        c = 21000000.0
        self.assertEqual(
            render_api.format_amount(c, trim=False, precision=5),
            "210,00"
        )
        c = 21000004.0
        self.assertEqual(
            render_api.format_amount(c, trim=False,precision=5),
            "210,00004"
        )
        c = 21000040.0
        self.assertEqual(
            render_api.format_amount(c, trim=False,precision=5),
            "210,0004"
        )

        self.assertEqual(
            render_api.format_amount(c, trim=True, precision=5),
            "210,00"
        )
        c = 21012000.0
        self.assertEqual(
            render_api.format_amount(c, trim=False, precision=5),
            "210,12"
        )
Beispiel #9
0
def deferred_remittance_amount_default(node, kw):
    """
        default value for the payment amount
    """
    from autonomie.views.render_api import format_amount
    return format_amount(get_amount_topay(kw), precision=5, grouping=False)
Beispiel #10
0
def deferred_remittance_amount_default(node, kw):
    """
        default value for the payment amount
    """
    from autonomie.views.render_api import format_amount
    return format_amount(get_amount_topay(kw), precision=5, grouping=False)
    def test_format_amount(self):
        a = 1525
        b = 1525.3
        locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
        self.assertEqual(render_api.format_amount(a), "15,25")
        self.assertEqual(render_api.format_amount(a, trim=False), "15,25")

        self.assertEqual(render_api.format_amount(b), "15,25")
        self.assertEqual(render_api.format_amount(b, trim=False), "15,25")

        c = 210000
        self.assertEqual(render_api.format_amount(c, grouping=False),
                         "2100,00")
        self.assertEqual(render_api.format_amount(c, grouping=True),
                         "2&nbsp;100,00")

        c = 21000000.0
        self.assertEqual(render_api.format_amount(c, trim=False, precision=5),
                         "210,00")
        c = 21000004.0
        self.assertEqual(render_api.format_amount(c, trim=False, precision=5),
                         "210,00004")
        c = 21000040.0
        self.assertEqual(render_api.format_amount(c, trim=False, precision=5),
                         "210,0004")

        self.assertEqual(render_api.format_amount(c, trim=True, precision=5),
                         "210,00")
        c = 21012000.0
        self.assertEqual(render_api.format_amount(c, trim=False, precision=5),
                         "210,12")
Beispiel #12
0
 def montant_remise(self):
     return render_api.format_amount(
         self.payment.remittance_amount,
         grouping=False,
     )