fix: Update account heads in GST test cases
This commit is contained in:
parent
cf445eb7b4
commit
ebc46c1e09
@ -1957,6 +1957,33 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
einvoice = make_einvoice(si)
|
einvoice = make_einvoice(si)
|
||||||
validate_totals(einvoice)
|
validate_totals(einvoice)
|
||||||
|
|
||||||
|
def test_item_tax_net_range(self):
|
||||||
|
item = create_item("T Shirt")
|
||||||
|
|
||||||
|
item.set('taxes', [])
|
||||||
|
item.append("taxes", {
|
||||||
|
"item_tax_template": "_Test Account Excise Duty @ 10 - _TC",
|
||||||
|
"minimum_net_rate": 0,
|
||||||
|
"maximum_net_rate": 500
|
||||||
|
})
|
||||||
|
|
||||||
|
item.append("taxes", {
|
||||||
|
"item_tax_template": "_Test Account Excise Duty @ 12 - _TC",
|
||||||
|
"minimum_net_rate": 501,
|
||||||
|
"maximum_net_rate": 1000
|
||||||
|
})
|
||||||
|
|
||||||
|
item.save()
|
||||||
|
|
||||||
|
sales_invoice = create_sales_invoice(item = "T Shirt", rate=700, do_not_submit=True)
|
||||||
|
self.assertEqual(sales_invoice.items[0].item_tax_template, "_Test Account Excise Duty @ 12 - _TC")
|
||||||
|
|
||||||
|
# Apply discount
|
||||||
|
sales_invoice.apply_discount_on = 'Net Total'
|
||||||
|
sales_invoice.discount_amount = 300
|
||||||
|
sales_invoice.save()
|
||||||
|
self.assertEqual(sales_invoice.items[0].item_tax_template, "_Test Account Excise Duty @ 10 - _TC")
|
||||||
|
|
||||||
def get_sales_invoice_for_e_invoice():
|
def get_sales_invoice_for_e_invoice():
|
||||||
si = make_sales_invoice_for_ewaybill()
|
si = make_sales_invoice_for_ewaybill()
|
||||||
si.naming_series = 'INV-2020-.#####'
|
si.naming_series = 'INV-2020-.#####'
|
||||||
@ -1985,32 +2012,6 @@ def get_sales_invoice_for_e_invoice():
|
|||||||
|
|
||||||
return si
|
return si
|
||||||
|
|
||||||
def test_item_tax_net_range(self):
|
|
||||||
item = create_item("T Shirt")
|
|
||||||
|
|
||||||
item.set('taxes', [])
|
|
||||||
item.append("taxes", {
|
|
||||||
"item_tax_template": "_Test Account Excise Duty @ 10 - _TC",
|
|
||||||
"minimum_net_rate": 0,
|
|
||||||
"maximum_net_rate": 500
|
|
||||||
})
|
|
||||||
|
|
||||||
item.append("taxes", {
|
|
||||||
"item_tax_template": "_Test Account Excise Duty @ 12 - _TC",
|
|
||||||
"minimum_net_rate": 501,
|
|
||||||
"maximum_net_rate": 1000
|
|
||||||
})
|
|
||||||
|
|
||||||
item.save()
|
|
||||||
|
|
||||||
sales_invoice = create_sales_invoice(item = "T Shirt", rate=700, do_not_submit=True)
|
|
||||||
self.assertEqual(sales_invoice.items[0].item_tax_template, "_Test Account Excise Duty @ 12 - _TC")
|
|
||||||
|
|
||||||
# Apply discount
|
|
||||||
sales_invoice.apply_discount_on = 'Net Total'
|
|
||||||
sales_invoice.discount_amount = 300
|
|
||||||
sales_invoice.save()
|
|
||||||
self.assertEqual(sales_invoice.items[0].item_tax_template, "_Test Account Excise Duty @ 10 - _TC")
|
|
||||||
|
|
||||||
def make_test_address_for_ewaybill():
|
def make_test_address_for_ewaybill():
|
||||||
if not frappe.db.exists('Address', '_Test Address for Eway bill-Billing'):
|
if not frappe.db.exists('Address', '_Test Address for Eway bill-Billing'):
|
||||||
@ -2087,9 +2088,9 @@ def make_sales_invoice_for_ewaybill():
|
|||||||
if not gst_account:
|
if not gst_account:
|
||||||
gst_settings.append("gst_accounts", {
|
gst_settings.append("gst_accounts", {
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"cgst_account": "CGST - _TC",
|
"cgst_account": "Output Tax CGST - _TC",
|
||||||
"sgst_account": "SGST - _TC",
|
"sgst_account": "Output Tax SGST - _TC",
|
||||||
"igst_account": "IGST - _TC",
|
"igst_account": "Output Tax IGST - _TC",
|
||||||
})
|
})
|
||||||
|
|
||||||
gst_settings.save()
|
gst_settings.save()
|
||||||
@ -2106,7 +2107,7 @@ def make_sales_invoice_for_ewaybill():
|
|||||||
|
|
||||||
si.append("taxes", {
|
si.append("taxes", {
|
||||||
"charge_type": "On Net Total",
|
"charge_type": "On Net Total",
|
||||||
"account_head": "CGST - _TC",
|
"account_head": "Output Tax CGST - _TC",
|
||||||
"cost_center": "Main - _TC",
|
"cost_center": "Main - _TC",
|
||||||
"description": "CGST @ 9.0",
|
"description": "CGST @ 9.0",
|
||||||
"rate": 9
|
"rate": 9
|
||||||
@ -2114,7 +2115,7 @@ def make_sales_invoice_for_ewaybill():
|
|||||||
|
|
||||||
si.append("taxes", {
|
si.append("taxes", {
|
||||||
"charge_type": "On Net Total",
|
"charge_type": "On Net Total",
|
||||||
"account_head": "SGST - _TC",
|
"account_head": "Output Tax SGST - _TC",
|
||||||
"cost_center": "Main - _TC",
|
"cost_center": "Main - _TC",
|
||||||
"description": "SGST @ 9.0",
|
"description": "SGST @ 9.0",
|
||||||
"rate": 9
|
"rate": 9
|
||||||
|
@ -46,14 +46,14 @@ class TestGSTR3BReport(unittest.TestCase):
|
|||||||
make_sales_invoice()
|
make_sales_invoice()
|
||||||
create_purchase_invoices()
|
create_purchase_invoices()
|
||||||
|
|
||||||
if frappe.db.exists("GSTR 3B Report", "GSTR3B-March-2019-_Test Address-Billing"):
|
if frappe.db.exists("GSTR 3B Report", "GSTR3B-March-2019-_Test Address GST-Billing"):
|
||||||
report = frappe.get_doc("GSTR 3B Report", "GSTR3B-March-2019-_Test Address-Billing")
|
report = frappe.get_doc("GSTR 3B Report", "GSTR3B-March-2019-_Test Address GST-Billing")
|
||||||
report.save()
|
report.save()
|
||||||
else:
|
else:
|
||||||
report = frappe.get_doc({
|
report = frappe.get_doc({
|
||||||
"doctype": "GSTR 3B Report",
|
"doctype": "GSTR 3B Report",
|
||||||
"company": "_Test Company GST",
|
"company": "_Test Company GST",
|
||||||
"company_address": "_Test Address-Billing",
|
"company_address": "_Test Address GST-Billing",
|
||||||
"year": getdate().year,
|
"year": getdate().year,
|
||||||
"month": month_number_mapping.get(getdate().month)
|
"month": month_number_mapping.get(getdate().month)
|
||||||
}).insert()
|
}).insert()
|
||||||
@ -89,7 +89,7 @@ class TestGSTR3BReport(unittest.TestCase):
|
|||||||
|
|
||||||
si.append("taxes", {
|
si.append("taxes", {
|
||||||
"charge_type": "On Net Total",
|
"charge_type": "On Net Total",
|
||||||
"account_head": "IGST - _GST",
|
"account_head": "Output Tax IGST - _GST",
|
||||||
"cost_center": "Main - _GST",
|
"cost_center": "Main - _GST",
|
||||||
"description": "IGST @ 18.0",
|
"description": "IGST @ 18.0",
|
||||||
"rate": 18
|
"rate": 18
|
||||||
@ -117,7 +117,7 @@ def make_sales_invoice():
|
|||||||
|
|
||||||
si.append("taxes", {
|
si.append("taxes", {
|
||||||
"charge_type": "On Net Total",
|
"charge_type": "On Net Total",
|
||||||
"account_head": "IGST - _GST",
|
"account_head": "Output Tax IGST - _GST",
|
||||||
"cost_center": "Main - _GST",
|
"cost_center": "Main - _GST",
|
||||||
"description": "IGST @ 18.0",
|
"description": "IGST @ 18.0",
|
||||||
"rate": 18
|
"rate": 18
|
||||||
@ -138,7 +138,7 @@ def make_sales_invoice():
|
|||||||
|
|
||||||
si1.append("taxes", {
|
si1.append("taxes", {
|
||||||
"charge_type": "On Net Total",
|
"charge_type": "On Net Total",
|
||||||
"account_head": "IGST - _GST",
|
"account_head": "Output Tax IGST - _GST",
|
||||||
"cost_center": "Main - _GST",
|
"cost_center": "Main - _GST",
|
||||||
"description": "IGST @ 18.0",
|
"description": "IGST @ 18.0",
|
||||||
"rate": 18
|
"rate": 18
|
||||||
@ -159,7 +159,7 @@ def make_sales_invoice():
|
|||||||
|
|
||||||
si2.append("taxes", {
|
si2.append("taxes", {
|
||||||
"charge_type": "On Net Total",
|
"charge_type": "On Net Total",
|
||||||
"account_head": "IGST - _GST",
|
"account_head": "Output Tax IGST - _GST",
|
||||||
"cost_center": "Main - _GST",
|
"cost_center": "Main - _GST",
|
||||||
"description": "IGST @ 18.0",
|
"description": "IGST @ 18.0",
|
||||||
"rate": 18
|
"rate": 18
|
||||||
@ -195,7 +195,7 @@ def create_purchase_invoices():
|
|||||||
|
|
||||||
pi.append("taxes", {
|
pi.append("taxes", {
|
||||||
"charge_type": "On Net Total",
|
"charge_type": "On Net Total",
|
||||||
"account_head": "CGST - _GST",
|
"account_head": "Input Tax CGST - _GST",
|
||||||
"cost_center": "Main - _GST",
|
"cost_center": "Main - _GST",
|
||||||
"description": "CGST @ 9.0",
|
"description": "CGST @ 9.0",
|
||||||
"rate": 9
|
"rate": 9
|
||||||
@ -203,7 +203,7 @@ def create_purchase_invoices():
|
|||||||
|
|
||||||
pi.append("taxes", {
|
pi.append("taxes", {
|
||||||
"charge_type": "On Net Total",
|
"charge_type": "On Net Total",
|
||||||
"account_head": "SGST - _GST",
|
"account_head": "Input Tax SGST - _GST",
|
||||||
"cost_center": "Main - _GST",
|
"cost_center": "Main - _GST",
|
||||||
"description": "SGST @ 9.0",
|
"description": "SGST @ 9.0",
|
||||||
"rate": 9
|
"rate": 9
|
||||||
@ -410,10 +410,10 @@ def make_company():
|
|||||||
company.country = "India"
|
company.country = "India"
|
||||||
company.insert()
|
company.insert()
|
||||||
|
|
||||||
if not frappe.db.exists('Address', '_Test Address-Billing'):
|
if not frappe.db.exists('Address', '_Test Address GST-Billing'):
|
||||||
address = frappe.get_doc({
|
address = frappe.get_doc({
|
||||||
|
"address_title": "_Test Address GST",
|
||||||
"address_line1": "_Test Address Line 1",
|
"address_line1": "_Test Address Line 1",
|
||||||
"address_title": "_Test Address",
|
|
||||||
"address_type": "Billing",
|
"address_type": "Billing",
|
||||||
"city": "_Test City",
|
"city": "_Test City",
|
||||||
"state": "Test State",
|
"state": "Test State",
|
||||||
@ -444,9 +444,9 @@ def set_account_heads():
|
|||||||
if not gst_account:
|
if not gst_account:
|
||||||
gst_settings.append("gst_accounts", {
|
gst_settings.append("gst_accounts", {
|
||||||
"company": "_Test Company GST",
|
"company": "_Test Company GST",
|
||||||
"cgst_account": "CGST - _GST",
|
"cgst_account": "Output Tax CGST - _GST",
|
||||||
"sgst_account": "SGST - _GST",
|
"sgst_account": "Output Tax SGST - _GST",
|
||||||
"igst_account": "IGST - _GST",
|
"igst_account": "Output Tax IGST - _GST"
|
||||||
})
|
})
|
||||||
|
|
||||||
gst_settings.save()
|
gst_settings.save()
|
||||||
|
@ -211,8 +211,6 @@ def get_or_create_account(company_name, account):
|
|||||||
'account_number': account.get('account_number')
|
'account_number': account.get('account_number')
|
||||||
})
|
})
|
||||||
|
|
||||||
print(company_name, account, existing_accounts)
|
|
||||||
|
|
||||||
if existing_accounts:
|
if existing_accounts:
|
||||||
return frappe.get_doc('Account', existing_accounts[0].name)
|
return frappe.get_doc('Account', existing_accounts[0].name)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user