mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-24 05:32:46 +01:00
refactor(test): make uae vat 201 deterministic
This commit is contained in:
@@ -15,16 +15,11 @@ from erpnext.regional.report.uae_vat_201.uae_vat_201 import (
|
||||
get_zero_rated_total,
|
||||
)
|
||||
from erpnext.stock.doctype.warehouse.test_warehouse import get_warehouse_account
|
||||
from erpnext.tests.utils import ERPNextTestSuite
|
||||
|
||||
|
||||
class TestUaeVat201(TestCase):
|
||||
class TestUaeVat201(ERPNextTestSuite):
|
||||
def setUp(self):
|
||||
frappe.set_user("Administrator")
|
||||
|
||||
frappe.db.sql("delete from `tabSales Invoice` where company='_Test Company UAE VAT'")
|
||||
frappe.db.sql("delete from `tabPurchase Invoice` where company='_Test Company UAE VAT'")
|
||||
|
||||
make_company("_Test Company UAE VAT", "_TCUV")
|
||||
set_vat_accounts()
|
||||
|
||||
make_customer()
|
||||
@@ -61,6 +56,9 @@ class TestUaeVat201(TestCase):
|
||||
self.assertEqual(get_standard_rated_expenses_total(filters), 250)
|
||||
self.assertEqual(get_standard_rated_expenses_tax(filters), 1)
|
||||
|
||||
@ERPNextTestSuite.change_settings(
|
||||
"Accounts Settings", {"allow_multi_currency_invoices_against_single_party_account": True}
|
||||
)
|
||||
def test_uae_vat_201_report_with_foreign_transaction(self):
|
||||
pi = make_purchase_invoice(
|
||||
company="_Test Company UAE VAT",
|
||||
@@ -93,31 +91,6 @@ class TestUaeVat201(TestCase):
|
||||
self.assertEqual(get_standard_rated_expenses_tax(filters), 50)
|
||||
|
||||
|
||||
def make_company(company_name, abbr):
|
||||
if not frappe.db.exists("Company", company_name):
|
||||
company = frappe.get_doc(
|
||||
{
|
||||
"doctype": "Company",
|
||||
"company_name": company_name,
|
||||
"abbr": abbr,
|
||||
"default_currency": "AED",
|
||||
"country": "United Arab Emirates",
|
||||
"create_chart_of_accounts_based_on": "Standard Template",
|
||||
}
|
||||
)
|
||||
company.insert()
|
||||
else:
|
||||
company = frappe.get_doc("Company", company_name)
|
||||
|
||||
company.create_default_warehouses()
|
||||
|
||||
if not frappe.db.get_value("Cost Center", {"is_group": 0, "company": company.name}):
|
||||
company.create_default_cost_center()
|
||||
|
||||
company.save()
|
||||
return company
|
||||
|
||||
|
||||
def set_vat_accounts():
|
||||
if not frappe.db.exists("UAE VAT Settings", "_Test Company UAE VAT"):
|
||||
vat_accounts = frappe.get_all(
|
||||
|
||||
@@ -985,6 +985,15 @@ class ERPNextTestSuite(unittest.TestCase):
|
||||
"doctype": "Company",
|
||||
"chart_of_accounts": "Standard",
|
||||
},
|
||||
{
|
||||
"abbr": "_TCUV",
|
||||
"company_name": "_Test Company UAE VAT",
|
||||
"country": "United Arab Emirates",
|
||||
"default_currency": "AED",
|
||||
"doctype": "Company",
|
||||
"domain": "Manufacturing",
|
||||
"create_chart_of_accounts_based_on": "Standard Template",
|
||||
},
|
||||
]
|
||||
cls.companies = []
|
||||
for x in records:
|
||||
|
||||
Reference in New Issue
Block a user