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
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
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
def prepare(discount=False): tva1 = MagicMock(name="tva1", value=1960, default=0, compte_cg="TVA0001", code='CTVA0001') tva2 = MagicMock(name="tva2", value=700, default=0, compte_cg="TVA0002", code='CTVA0002') p1 = MagicMock(name="product 1", compte_cg="P0001", tva=tva1) p2 = MagicMock(name="product 2", compte_cg="P0002", tva=tva2) line1 = DummyLine(cost=10000, quantity=1, tva=tva1.value, product=p1, tva_object=tva1) line2 = DummyLine(cost=10000, quantity=1, tva=tva1.value, product=p1, tva_object=tva1) line3 = DummyLine(cost=10000, quantity=1, tva=tva2.value, product=p2, tva_object=tva2) 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 = 1960 invoice.expenses_tva = 1960 invoice.taskDate = datetime.date(2013, 02, 02) invoice.customer = customer invoice.company = company invoice.official_number = "INV_001" invoice.lines = [line1, line2, line3] if discount: discount1 = DummyLine(cost=10000, quantity=1, tva=tva1.value, tva_object=tva1) discount2 = DummyLine(cost=10000, quantity=1, tva=tva2.value, tva_object=tva2) invoice.discounts = [discount1, discount2] invoice.expenses_ht = 10000 invoice.expenses = 10000 return ((tva1, tva2), (p1, p2), invoice)
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
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
def prepare(discount=False): tva1 = MagicMock(name="tva1", value=1960, default=0, compte_cg="TVA0001", code='CTVA0001') tva2 = MagicMock( name="tva2", value=700, default=0, compte_cg="TVA0002", code='CTVA0002' ) p1 = MagicMock(name="product 1", compte_cg="P0001", tva=tva1) p2 = MagicMock(name="product 2", compte_cg="P0002", tva=tva2) line1 = DummyLine(cost=10000, quantity=1, tva=tva1.value, product=p1, tva_object=tva1) line2 = DummyLine(cost=10000, quantity=1, tva=tva1.value, product=p1, tva_object=tva1) line3 = DummyLine(cost=10000, quantity=1, tva=tva2.value, product=p2, tva_object=tva2) 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 = 1960 invoice.expenses_tva = 1960 invoice.taskDate = datetime.date(2013, 02, 02) invoice.customer = customer invoice.company = company invoice.official_number = "INV_001" invoice.lines = [line1, line2, line3] if discount: discount1 = DummyLine(cost=10000, quantity=1, tva=tva1.value, tva_object=tva1) discount2 = DummyLine(cost=10000, quantity=1, tva=tva2.value, tva_object=tva2) invoice.discounts = [discount1, discount2] invoice.expenses_ht = 10000 invoice.expenses = 10000 return ((tva1, tva2), (p1, p2), invoice)