Пример #1
0
def invoice_bug363(def_tva, tva10):
    prod = MagicMock(name="product 2", compte_cg="P0002", tva=tva10)
    lines = []

    for cost, qtity in (
        (15000000, 1),
        (2000000, 86),
        (-173010000, 1),
        (10000000, 1),
        (-201845000, 1),
        (4500000, 33),
        (1800000, 74),
        (3500000, 28),
    ):
        lines.append(DummyLine(cost=cost, quantity=qtity, tva=tva10.value, product=prod, tva_object=tva10))

    group = DummyGroup(lines=lines)
    company = Dummy(name="company", code_compta="COMP_CG", contribution=None)
    customer = Dummy(name="customer", compte_tiers="CUSTOMER", compte_cg="CG_CUSTOMER")
    invoice = TaskCompute()
    invoice.default_tva = def_tva.value
    invoice.expenses_tva = def_tva.value
    invoice.date = datetime.date(2016, 05, 04)
    invoice.customer = customer
    invoice.company = company
    invoice.official_number = "INV_002"
    invoice.line_groups = [group]
    invoice.all_lines = group.lines
    invoice.expenses_ht = 0
    invoice.expenses = 0
    return invoice
Пример #2
0
def invoice_bug400(def_tva, tva20):
    prod = MagicMock(name="product 2", compte_cg="P0002", tva=tva20)
    lines = []

    for cost, qtity in ((22112500, 1), ):
        lines.append(
            DummyLine(cost=cost,
                      quantity=qtity,
                      tva=tva20.value,
                      product=prod,
                      tva_object=tva20))

    group = DummyGroup(lines=lines)
    company = Dummy(name="company", code_compta='COMP_CG', contribution=None)
    customer = Dummy(name="customer",
                     compte_tiers="CUSTOMER",
                     compte_cg='CG_CUSTOMER')
    invoice = TaskCompute()
    invoice.default_tva = def_tva.value
    invoice.expenses_tva = def_tva.value
    invoice.date = datetime.date(2013, 02, 02)
    invoice.customer = customer
    invoice.company = company
    invoice.official_number = "INV_001"
    invoice.line_groups = [group]
    invoice.all_lines = group.lines
    invoice.expenses_ht = 0
    invoice.expenses = 0
    return invoice
Пример #3
0
def invoice_bug400(def_tva, tva20):
    prod = MagicMock(name="product 2", compte_cg="P0002", tva=tva20)
    lines = []

    for cost, qtity in (
        (22112500, 1),
    ):
        lines.append(
            DummyLine(
                cost=cost,
                quantity=qtity,
                tva=tva20.value,
                product=prod,
                tva_object=tva20
            )
        )

    group = DummyGroup(lines=lines)
    company = Dummy(name="company", code_compta='COMP_CG', contribution=None)
    customer = Dummy(name="customer", compte_tiers="CUSTOMER",
                     compte_cg='CG_CUSTOMER')
    invoice = TaskCompute()
    invoice.default_tva = def_tva.value
    invoice.expenses_tva = def_tva.value
    invoice.date = datetime.date(2013, 02, 02)
    invoice.customer = customer
    invoice.company = company
    invoice.official_number = "INV_001"
    invoice.line_groups = [group]
    invoice.all_lines = group.lines
    invoice.expenses_ht = 0
    invoice.expenses = 0
    return invoice
Пример #4
0
 def test_total_ttc(self):
     task = TaskCompute()
     task.line_groups = [DummyGroup(lines=[DummyLine(cost=1030000, quantity=1.25, tva=1960)])]
     # cf ticket #501
     # line total : 12.875
     # tva : 2.5235 -> 2.52
     # => total : 15.40 (au lieu de 15.395)
     assert task.total_ttc() == 1540000
Пример #5
0
 def test_get_tva_ht_parts(self):
     task = TaskCompute()
     task.expenses_tva = 2000
     task.line_groups = [
         DummyGroup(lines=[
             DummyLine(cost=-120000000, quantity=1, tva=2000),
             DummyLine(cost=-120000000, quantity=0.5, tva=2000),
         ])
     ]
     task.expenses_ht = -36000000
     assert task.tva_ht_parts()[2000] == -216000000.0
Пример #6
0
 def test_total_ttc(self):
     task = TaskCompute()
     task.line_groups = [
         DummyGroup(
             lines=[DummyLine(cost=1030000, quantity=1.25, tva=1960)])
     ]
     # cf ticket #501
     # line total : 12.875
     # tva : 2.5235 -> 2.52
     # => total : 15.40 (au lieu de 15.395)
     assert task.total_ttc() == 1540000
Пример #7
0
 def test_get_tva_ht_parts(self):
     task = TaskCompute()
     task.expenses_tva = 2000
     task.line_groups = [DummyGroup(
         lines=[
             DummyLine(cost=-120000000, quantity=1, tva=2000),
             DummyLine(cost=-120000000, quantity=0.5, tva=2000),
         ]
     )]
     task.expenses_ht = -36000000
     assert task.tva_ht_parts()[2000] == -216000000.0
Пример #8
0
 def test_get_tvas_multiple_rounding(self):
     task = TaskCompute()
     task.line_groups = [
         DummyGroup(
             lines=[DummyLine(cost=10004000, quantity=1, tva=1000), DummyLine(cost=5002000, quantity=1, tva=2000)]
         )
     ]
     # Ref https://github.com/CroissanceCommune/autonomie/issues/305
     tvas = task.get_tvas()
     assert tvas[1000] == 1000000
     assert task.tva_amount() == 2000000
Пример #9
0
 def test_get_tvas_multiple_rounding(self):
     task = TaskCompute()
     task.line_groups = [
         DummyGroup(lines=[
             DummyLine(cost=10004000, quantity=1, tva=1000),
             DummyLine(cost=5002000, quantity=1, tva=2000),
         ])
     ]
     # Ref https://github.com/CroissanceCommune/autonomie/issues/305
     tvas = task.get_tvas()
     assert tvas[1000] == 1000000
     assert task.tva_amount() == 2000000
Пример #10
0
 def test_get_tvas_multiple(self):
     task = TaskCompute()
     task.line_groups = [
         DummyGroup(
             lines=[DummyLine(cost=35000000, quantity=1, tva=1960), DummyLine(cost=40000000, quantity=1, tva=550)]
         )
     ]
     task.discounts = [DummyDiscountLine(amount=1200000, tva=550), DummyDiscountLine(amount=15000000, tva=1960)]
     tvas = task.get_tvas()
     assert tvas.keys() == [1960, 550]
     assert tvas[1960] == 3920000
     assert tvas[550] == 2134000
Пример #11
0
 def test_get_tvas_multiple(self):
     task = TaskCompute()
     task.line_groups = [
         DummyGroup(lines=[
             DummyLine(cost=35000000, quantity=1, tva=1960),
             DummyLine(cost=40000000, quantity=1, tva=550)
         ])
     ]
     task.discounts = [
         DummyDiscountLine(amount=1200000, tva=550),
         DummyDiscountLine(amount=15000000, tva=1960)
     ]
     tvas = task.get_tvas()
     assert tvas.keys() == [1960, 550]
     assert tvas[1960] == 3920000
     assert tvas[550] == 2134000
Пример #12
0
def invoice(def_tva, tva):

    p1 = MagicMock(name="product 1", compte_cg="P0001", tva=def_tva)
    p2 = MagicMock(name="product 2", compte_cg="P0002", tva=tva)
    line1 = DummyLine(cost=10000000,
                      quantity=1,
                      tva=def_tva.value,
                      product=p1,
                      tva_object=def_tva)
    line2 = DummyLine(
        cost=10000000,
        quantity=1,
        tva=def_tva.value,
        product=p1,
        tva_object=def_tva,
    )
    line3 = DummyLine(
        cost=10000000,
        quantity=1,
        tva=tva.value,
        product=p2,
        tva_object=tva,
    )

    group = DummyGroup(lines=(
        line1,
        line2,
        line3,
    ))

    company = Dummy(name="company", code_compta='COMP_CG', contribution=None)
    customer = Dummy(name="customer",
                     compte_tiers="CUSTOMER",
                     compte_cg='CG_CUSTOMER')
    invoice = TaskCompute()
    invoice.default_tva = def_tva.value
    invoice.expenses_tva = def_tva.value
    invoice.date = datetime.date(2013, 02, 02)
    invoice.customer = customer
    invoice.company = company
    invoice.official_number = "INV_001"
    invoice.line_groups = [group]
    invoice.all_lines = group.lines
    invoice.expenses_ht = 10000000
    invoice.expenses = 10000000
    return invoice
Пример #13
0
def invoice(def_tva, tva):

    p1 = MagicMock(name="product 1", compte_cg="P0001", tva=def_tva)
    p2 = MagicMock(name="product 2", compte_cg="P0002", tva=tva)
    line1 = DummyLine(
        cost=10000000,
        quantity=1,
        tva=def_tva.value,
        product=p1,
        tva_object=def_tva
    )
    line2 = DummyLine(
        cost=10000000,
        quantity=1,
        tva=def_tva.value,
        product=p1,
        tva_object=def_tva,
    )
    line3 = DummyLine(
        cost=10000000,
        quantity=1,
        tva=tva.value,
        product=p2,
        tva_object=tva,
    )

    group = DummyGroup(lines=(line1, line2, line3,))

    company = Dummy(name="company", code_compta='COMP_CG', contribution=None)
    customer = Dummy(
        label="customer",
        compte_tiers="CUSTOMER",
        compte_cg='CG_CUSTOMER'
    )
    invoice = TaskCompute()
    invoice.default_tva = def_tva.value
    invoice.expenses_tva = def_tva.value
    invoice.date = datetime.date(2013, 02, 02)
    invoice.customer = customer
    invoice.company = company
    invoice.official_number = "INV_001"
    invoice.line_groups = [group]
    invoice.all_lines = group.lines
    invoice.expenses_ht = 10000000
    invoice.expenses = 10000000
    return invoice