fix: Tests
This commit is contained in:
parent
5a06019440
commit
c765073c2a
@ -250,17 +250,16 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
additional_discount_account = create_account(account_name="Discount Account",
|
additional_discount_account = create_account(account_name="Discount Account",
|
||||||
parent_account="Indirect Expenses - _TC", company="_Test Company")
|
parent_account="Indirect Expenses - _TC", company="_Test Company")
|
||||||
|
|
||||||
pi = make_purchase_invoice(qty=1, rate=100, do_not_save=1)
|
pi = make_purchase_invoice(qty=1, rate=100, do_not_save=1, parent_cost_center="Main - _TC")
|
||||||
pi.apply_discount_on = "Grand Total"
|
pi.apply_discount_on = "Grand Total"
|
||||||
pi.additional_discount_account = additional_discount_account
|
pi.additional_discount_account = additional_discount_account
|
||||||
pi.additional_discount_percentage = 20
|
pi.additional_discount_percentage = 20
|
||||||
pi.append("taxes", {
|
pi.append("taxes", {
|
||||||
"charge_type": "On Net Total",
|
"charge_type": "Actual",
|
||||||
"account_head": "CGST - _TC",
|
"account_head": "_Test Account VAT - _TC",
|
||||||
"cost_center": "Main - _TC",
|
"cost_center": "Main - _TC",
|
||||||
"description": "CGST @ 9.0",
|
"description": "Test",
|
||||||
"base_tax_amount": 20,
|
"tax_amount": 20
|
||||||
"base_tax_amount_after_discount_amount": 20
|
|
||||||
})
|
})
|
||||||
pi.submit()
|
pi.submit()
|
||||||
|
|
||||||
@ -273,10 +272,10 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
# print(gl, "\n")
|
# print(gl, "\n")
|
||||||
|
|
||||||
expected_gle = [
|
expected_gle = [
|
||||||
["CGST - _TC", 20.0, 0.0, nowdate()],
|
["_Test Account Cost for Goods Sold - _TC", 100.0, 0.0, nowdate()],
|
||||||
|
["_Test Account VAT - _TC", 20.0, 0.0, nowdate()],
|
||||||
["Creditors - _TC", 0.0, 96.0, nowdate()],
|
["Creditors - _TC", 0.0, 96.0, nowdate()],
|
||||||
["Discount Account - _TC", 0.0, 24.0, nowdate()],
|
["Discount Account - _TC", 0.0, 24.0, nowdate()]
|
||||||
["_Test Account Cost for Goods Sold - _TC", 100.0, 0.0, nowdate()]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
check_gl_entries(self, pi.name, expected_gle, nowdate())
|
check_gl_entries(self, pi.name, expected_gle, nowdate())
|
||||||
@ -1197,6 +1196,7 @@ def check_gl_entries(doc, voucher_no, expected_gle, posting_date):
|
|||||||
where voucher_type='Purchase Invoice' and voucher_no=%s and posting_date >= %s
|
where voucher_type='Purchase Invoice' and voucher_no=%s and posting_date >= %s
|
||||||
order by posting_date asc, account asc""", (voucher_no, posting_date), as_dict=1)
|
order by posting_date asc, account asc""", (voucher_no, posting_date), as_dict=1)
|
||||||
|
|
||||||
|
print(gl_entries)
|
||||||
for i, gle in enumerate(gl_entries):
|
for i, gle in enumerate(gl_entries):
|
||||||
doc.assertEqual(expected_gle[i][0], gle.account)
|
doc.assertEqual(expected_gle[i][0], gle.account)
|
||||||
doc.assertEqual(expected_gle[i][1], gle.debit)
|
doc.assertEqual(expected_gle[i][1], gle.debit)
|
||||||
@ -1260,7 +1260,7 @@ def make_purchase_invoice(**args):
|
|||||||
pi.return_against = args.return_against
|
pi.return_against = args.return_against
|
||||||
pi.is_subcontracted = args.is_subcontracted or "No"
|
pi.is_subcontracted = args.is_subcontracted or "No"
|
||||||
pi.supplier_warehouse = args.supplier_warehouse or "_Test Warehouse 1 - _TC"
|
pi.supplier_warehouse = args.supplier_warehouse or "_Test Warehouse 1 - _TC"
|
||||||
pi.cost_center = args.cost_center or "_Test Cost Center - _TC"
|
pi.cost_center = args.parent_cost_center
|
||||||
|
|
||||||
pi.append("items", {
|
pi.append("items", {
|
||||||
"item_code": args.item or args.item_code or "_Test Item",
|
"item_code": args.item or args.item_code or "_Test Item",
|
||||||
|
@ -2014,16 +2014,17 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
si.additional_discount_percentage = 20
|
si.additional_discount_percentage = 20
|
||||||
si.append("taxes", {
|
si.append("taxes", {
|
||||||
"charge_type": "Actual",
|
"charge_type": "Actual",
|
||||||
"account_head": "CGST - _TC",
|
"account_head": "_Test Account VAT - _TC",
|
||||||
"cost_center": "Main - _TC",
|
"cost_center": "Main - _TC",
|
||||||
"description": "CGST @ 9.0",
|
"parent_cost_center": "Main - _TC",
|
||||||
|
"description": "Test",
|
||||||
"rate": 0,
|
"rate": 0,
|
||||||
"tax_amount": 20
|
"tax_amount": 20
|
||||||
})
|
})
|
||||||
si.submit()
|
si.submit()
|
||||||
|
|
||||||
expected_gle = [
|
expected_gle = [
|
||||||
["CGST - _TC", 0.0, 20.0, nowdate()],
|
["_Test Account VAT - _TC", 0.0, 20.0, nowdate()],
|
||||||
["Debtors - _TC", 96.0, 0.0, nowdate()],
|
["Debtors - _TC", 96.0, 0.0, nowdate()],
|
||||||
["Discount Account - _TC", 24.0, 0.0, nowdate()],
|
["Discount Account - _TC", 24.0, 0.0, nowdate()],
|
||||||
["Sales - _TC", 0.0, 100.0, nowdate()]
|
["Sales - _TC", 0.0, 100.0, nowdate()]
|
||||||
@ -2199,7 +2200,7 @@ def create_sales_invoice(**args):
|
|||||||
si.currency=args.currency or "INR"
|
si.currency=args.currency or "INR"
|
||||||
si.conversion_rate = args.conversion_rate or 1
|
si.conversion_rate = args.conversion_rate or 1
|
||||||
si.naming_series = args.naming_series or "T-SINV-"
|
si.naming_series = args.naming_series or "T-SINV-"
|
||||||
si.cost_center = args.cost_center or "_Test Cost Center - _TC"
|
si.cost_center = args.parent_cost_center
|
||||||
|
|
||||||
si.append("items", {
|
si.append("items", {
|
||||||
"item_code": args.item or args.item_code or "_Test Item",
|
"item_code": args.item or args.item_code or "_Test Item",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user