test: test_tax_calculation_with_item_tax_template
This commit is contained in:
parent
5085673030
commit
bbd1e47758
@ -381,6 +381,63 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(si.grand_total, 5474.0)
|
self.assertEqual(si.grand_total, 5474.0)
|
||||||
|
|
||||||
|
def test_tax_calculation_with_item_tax_template(self):
|
||||||
|
si = create_sales_invoice(qty=84, rate=4.6, do_not_save=True)
|
||||||
|
item_row = si.get("items")[0]
|
||||||
|
|
||||||
|
add_items = [
|
||||||
|
(54, '_Test Account Excise Duty @ 12'),
|
||||||
|
(288, '_Test Account Excise Duty @ 15'),
|
||||||
|
(144, '_Test Account Excise Duty @ 20'),
|
||||||
|
(430, '_Test Item Tax Template 1')
|
||||||
|
]
|
||||||
|
for qty, item_tax_template in add_items:
|
||||||
|
item_row_copy = copy.deepcopy(item_row)
|
||||||
|
item_row_copy.qty = qty
|
||||||
|
item_row_copy.item_tax_template = item_tax_template
|
||||||
|
si.append("items", item_row_copy)
|
||||||
|
|
||||||
|
si.append("taxes", {
|
||||||
|
"account_head": "_Test Account Excise Duty - _TC",
|
||||||
|
"charge_type": "On Net Total",
|
||||||
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
"description": "Excise Duty",
|
||||||
|
"doctype": "Sales Taxes and Charges",
|
||||||
|
"rate": 11
|
||||||
|
})
|
||||||
|
si.append("taxes", {
|
||||||
|
"account_head": "_Test Account Education Cess - _TC",
|
||||||
|
"charge_type": "On Net Total",
|
||||||
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
"description": "Education Cess",
|
||||||
|
"doctype": "Sales Taxes and Charges",
|
||||||
|
"rate": 0
|
||||||
|
})
|
||||||
|
si.append("taxes", {
|
||||||
|
"account_head": "_Test Account S&H Education Cess - _TC",
|
||||||
|
"charge_type": "On Net Total",
|
||||||
|
"cost_center": "_Test Cost Center - _TC",
|
||||||
|
"description": "S&H Education Cess",
|
||||||
|
"doctype": "Sales Taxes and Charges",
|
||||||
|
"rate": 3
|
||||||
|
})
|
||||||
|
si.insert()
|
||||||
|
|
||||||
|
self.assertEqual(si.net_total, 4600)
|
||||||
|
|
||||||
|
self.assertEqual(si.get("taxes")[0].tax_amount, 502.41)
|
||||||
|
self.assertEqual(si.get("taxes")[0].total, 5102.41)
|
||||||
|
|
||||||
|
self.assertEqual(si.get("taxes")[1].tax_amount, 197.80)
|
||||||
|
self.assertEqual(si.get("taxes")[1].total, 5300.21)
|
||||||
|
|
||||||
|
self.assertEqual(si.get("taxes")[2].tax_amount, 375.36)
|
||||||
|
self.assertEqual(si.get("taxes")[2].total, 5675.57)
|
||||||
|
|
||||||
|
self.assertEqual(si.grand_total, 5675.57)
|
||||||
|
self.assertEqual(si.rounding_adjustment, 0.43)
|
||||||
|
self.assertEqual(si.rounded_total, 5676.0)
|
||||||
|
|
||||||
def test_tax_calculation_with_multiple_items_and_discount(self):
|
def test_tax_calculation_with_multiple_items_and_discount(self):
|
||||||
si = create_sales_invoice(qty=1, rate=75, do_not_save=True)
|
si = create_sales_invoice(qty=1, rate=75, do_not_save=True)
|
||||||
item_row = si.get("items")[0]
|
item_row = si.get("items")[0]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user