mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 18:04:46 +00:00
Revert 'fix: tests depending on global default company'
This commit is contained in:
@@ -238,10 +238,6 @@ class Subscription(Document):
|
|||||||
Creates a `Sales Invoice`, submits it and returns it
|
Creates a `Sales Invoice`, submits it and returns it
|
||||||
"""
|
"""
|
||||||
invoice = frappe.new_doc('Sales Invoice')
|
invoice = frappe.new_doc('Sales Invoice')
|
||||||
|
|
||||||
if not invoice.company:
|
|
||||||
invoice.company = frappe.db.get_value('Global Defaults', None, 'default_company')
|
|
||||||
|
|
||||||
invoice.set_posting_time = 1
|
invoice.set_posting_time = 1
|
||||||
invoice.posting_date = self.current_invoice_start
|
invoice.posting_date = self.current_invoice_start
|
||||||
invoice.customer = self.customer
|
invoice.customer = self.customer
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ class TestClinicalProcedure(unittest.TestCase):
|
|||||||
self.assertEquals(frappe.db.get_value('Item', procedure_template.item, 'disabled'), 1)
|
self.assertEquals(frappe.db.get_value('Item', procedure_template.item, 'disabled'), 1)
|
||||||
|
|
||||||
def test_consumables(self):
|
def test_consumables(self):
|
||||||
frappe.db.set_value('Global Defaults', None, 'default_company', '_Test Company')
|
|
||||||
patient, medical_department, practitioner = create_healthcare_docs()
|
patient, medical_department, practitioner = create_healthcare_docs()
|
||||||
procedure_template = create_clinical_procedure_template()
|
procedure_template = create_clinical_procedure_template()
|
||||||
procedure_template.allow_stock_consumption = 1
|
procedure_template.allow_stock_consumption = 1
|
||||||
@@ -39,7 +38,6 @@ class TestClinicalProcedure(unittest.TestCase):
|
|||||||
result = procedure.complete_procedure()
|
result = procedure.complete_procedure()
|
||||||
# check consumption
|
# check consumption
|
||||||
self.assertTrue(frappe.db.exists('Stock Entry', result))
|
self.assertTrue(frappe.db.exists('Stock Entry', result))
|
||||||
frappe.db.set_value('Global Defaults', None, 'default_company', None)
|
|
||||||
|
|
||||||
|
|
||||||
def create_consumable():
|
def create_consumable():
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ class TestPatient(unittest.TestCase):
|
|||||||
self.assertTrue(frappe.db.get_value('Patient', patient, 'customer'))
|
self.assertTrue(frappe.db.get_value('Patient', patient, 'customer'))
|
||||||
|
|
||||||
def test_patient_registration(self):
|
def test_patient_registration(self):
|
||||||
frappe.db.set_value('Global Defaults', None, 'default_company', '_Test Company')
|
|
||||||
frappe.db.sql("""delete from `tabPatient`""")
|
frappe.db.sql("""delete from `tabPatient`""")
|
||||||
settings = frappe.get_single('Healthcare Settings')
|
settings = frappe.get_single('Healthcare Settings')
|
||||||
settings.collect_registration_fee = 1
|
settings.collect_registration_fee = 1
|
||||||
@@ -33,4 +32,3 @@ class TestPatient(unittest.TestCase):
|
|||||||
|
|
||||||
settings.collect_registration_fee = 0
|
settings.collect_registration_fee = 0
|
||||||
settings.save()
|
settings.save()
|
||||||
frappe.db.set_value('Global Defaults', None, 'default_company', None)
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ class TestPatientMedicalRecord(unittest.TestCase):
|
|||||||
frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1)
|
frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1)
|
||||||
|
|
||||||
def test_medical_record(self):
|
def test_medical_record(self):
|
||||||
frappe.db.set_value('Global Defaults', None, 'default_company', '_Test Company')
|
|
||||||
patient, medical_department, practitioner = create_healthcare_docs()
|
patient, medical_department, practitioner = create_healthcare_docs()
|
||||||
appointment = create_appointment(patient, practitioner, nowdate(), invoice=1)
|
appointment = create_appointment(patient, practitioner, nowdate(), invoice=1)
|
||||||
encounter = create_encounter(appointment)
|
encounter = create_encounter(appointment)
|
||||||
@@ -39,7 +38,6 @@ class TestPatientMedicalRecord(unittest.TestCase):
|
|||||||
# check for lab test
|
# check for lab test
|
||||||
medical_rec = frappe.db.exists('Patient Medical Record', {'status': 'Open', 'reference_name': lab_test.name})
|
medical_rec = frappe.db.exists('Patient Medical Record', {'status': 'Open', 'reference_name': lab_test.name})
|
||||||
self.assertTrue(medical_rec)
|
self.assertTrue(medical_rec)
|
||||||
frappe.db.set_value('Global Defaults', None, 'default_company', None)
|
|
||||||
|
|
||||||
|
|
||||||
def create_procedure(appointment):
|
def create_procedure(appointment):
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class TestEmployeeTaxExemptionDeclaration(unittest.TestCase):
|
|||||||
declaration = frappe.get_doc({
|
declaration = frappe.get_doc({
|
||||||
"doctype": "Employee Tax Exemption Declaration",
|
"doctype": "Employee Tax Exemption Declaration",
|
||||||
"employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"),
|
"employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"),
|
||||||
"company": erpnext.get_default_company() or 'Wind Power LLC',
|
"company": erpnext.get_default_company(),
|
||||||
"payroll_period": "_Test Payroll Period",
|
"payroll_period": "_Test Payroll Period",
|
||||||
"declarations": [
|
"declarations": [
|
||||||
dict(exemption_sub_category = "_Test Sub Category",
|
dict(exemption_sub_category = "_Test Sub Category",
|
||||||
@@ -37,7 +37,7 @@ class TestEmployeeTaxExemptionDeclaration(unittest.TestCase):
|
|||||||
declaration = frappe.get_doc({
|
declaration = frappe.get_doc({
|
||||||
"doctype": "Employee Tax Exemption Declaration",
|
"doctype": "Employee Tax Exemption Declaration",
|
||||||
"employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"),
|
"employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"),
|
||||||
"company": erpnext.get_default_company() or 'Wind Power LLC',
|
"company": erpnext.get_default_company(),
|
||||||
"payroll_period": "_Test Payroll Period",
|
"payroll_period": "_Test Payroll Period",
|
||||||
"declarations": [
|
"declarations": [
|
||||||
dict(exemption_sub_category = "_Test Sub Category",
|
dict(exemption_sub_category = "_Test Sub Category",
|
||||||
@@ -52,7 +52,7 @@ class TestEmployeeTaxExemptionDeclaration(unittest.TestCase):
|
|||||||
duplicate_declaration = frappe.get_doc({
|
duplicate_declaration = frappe.get_doc({
|
||||||
"doctype": "Employee Tax Exemption Declaration",
|
"doctype": "Employee Tax Exemption Declaration",
|
||||||
"employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"),
|
"employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"),
|
||||||
"company": erpnext.get_default_company() or 'Wind Power LLC',
|
"company": erpnext.get_default_company(),
|
||||||
"payroll_period": "_Test Payroll Period",
|
"payroll_period": "_Test Payroll Period",
|
||||||
"declarations": [
|
"declarations": [
|
||||||
dict(exemption_sub_category = "_Test Sub Category",
|
dict(exemption_sub_category = "_Test Sub Category",
|
||||||
@@ -68,7 +68,7 @@ class TestEmployeeTaxExemptionDeclaration(unittest.TestCase):
|
|||||||
declaration = frappe.get_doc({
|
declaration = frappe.get_doc({
|
||||||
"doctype": "Employee Tax Exemption Declaration",
|
"doctype": "Employee Tax Exemption Declaration",
|
||||||
"employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"),
|
"employee": frappe.get_value("Employee", {"user_id":"employee@taxexepmtion.com"}, "name"),
|
||||||
"company": erpnext.get_default_company() or 'Wind Power LLC',
|
"company": erpnext.get_default_company(),
|
||||||
"payroll_period": "_Test Payroll Period",
|
"payroll_period": "_Test Payroll Period",
|
||||||
"declarations": [
|
"declarations": [
|
||||||
dict(exemption_sub_category = "_Test Sub Category",
|
dict(exemption_sub_category = "_Test Sub Category",
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class TestLeavePeriod(unittest.TestCase):
|
|||||||
|
|
||||||
def create_leave_period(from_date, to_date, company=None):
|
def create_leave_period(from_date, to_date, company=None):
|
||||||
leave_period = frappe.db.get_value('Leave Period',
|
leave_period = frappe.db.get_value('Leave Period',
|
||||||
dict(company=company or erpnext.get_default_company() or 'Wind Power LLC',
|
dict(company=company or erpnext.get_default_company(),
|
||||||
from_date=from_date,
|
from_date=from_date,
|
||||||
to_date=to_date,
|
to_date=to_date,
|
||||||
is_active=1), 'name')
|
is_active=1), 'name')
|
||||||
@@ -54,7 +54,7 @@ def create_leave_period(from_date, to_date, company=None):
|
|||||||
|
|
||||||
leave_period = frappe.get_doc({
|
leave_period = frappe.get_doc({
|
||||||
"doctype": "Leave Period",
|
"doctype": "Leave Period",
|
||||||
"company": company or erpnext.get_default_company() or 'Wind Power LLC',
|
"company": company or erpnext.get_default_company(),
|
||||||
"from_date": from_date,
|
"from_date": from_date,
|
||||||
"to_date": to_date,
|
"to_date": to_date,
|
||||||
"is_active": 1
|
"is_active": 1
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class TestPayrollEntry(unittest.TestCase):
|
|||||||
frappe.db.set_value("HR Settings", None, "email_salary_slip_to_employee", 0)
|
frappe.db.set_value("HR Settings", None, "email_salary_slip_to_employee", 0)
|
||||||
|
|
||||||
def test_payroll_entry(self): # pylint: disable=no-self-use
|
def test_payroll_entry(self): # pylint: disable=no-self-use
|
||||||
company = erpnext.get_default_company() or 'Wind Power LLC'
|
company = erpnext.get_default_company()
|
||||||
for data in frappe.get_all('Salary Component', fields = ["name"]):
|
for data in frappe.get_all('Salary Component', fields = ["name"]):
|
||||||
if not frappe.db.get_value('Salary Component Account',
|
if not frappe.db.get_value('Salary Component Account',
|
||||||
{'parent': data.name, 'company': company}, 'name'):
|
{'parent': data.name, 'company': company}, 'name'):
|
||||||
@@ -157,7 +157,7 @@ def make_payroll_entry(**args):
|
|||||||
args = frappe._dict(args)
|
args = frappe._dict(args)
|
||||||
|
|
||||||
payroll_entry = frappe.new_doc("Payroll Entry")
|
payroll_entry = frappe.new_doc("Payroll Entry")
|
||||||
payroll_entry.company = args.company or erpnext.get_default_company() or 'Wind Power LLC'
|
payroll_entry.company = args.company or erpnext.get_default_company()
|
||||||
payroll_entry.start_date = args.start_date or "2016-11-01"
|
payroll_entry.start_date = args.start_date or "2016-11-01"
|
||||||
payroll_entry.end_date = args.end_date or "2016-11-30"
|
payroll_entry.end_date = args.end_date or "2016-11-30"
|
||||||
payroll_entry.payment_account = get_payment_account()
|
payroll_entry.payment_account = get_payment_account()
|
||||||
@@ -183,7 +183,7 @@ def make_payroll_entry(**args):
|
|||||||
|
|
||||||
def get_payment_account():
|
def get_payment_account():
|
||||||
return frappe.get_value('Account',
|
return frappe.get_value('Account',
|
||||||
{'account_type': 'Cash', 'company': erpnext.get_default_company() or 'Wind Power LLC', 'is_group':0}, "name")
|
{'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
|
||||||
|
|
||||||
def make_holiday(holiday_list_name):
|
def make_holiday(holiday_list_name):
|
||||||
if not frappe.db.exists('Holiday List', holiday_list_name):
|
if not frappe.db.exists('Holiday List', holiday_list_name):
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ class TestSalarySlip(unittest.TestCase):
|
|||||||
self.assertEqual(ss.net_pay, (flt(ss.gross_pay) - (flt(ss.total_deduction) + flt(ss.total_loan_repayment))))
|
self.assertEqual(ss.net_pay, (flt(ss.gross_pay) - (flt(ss.total_deduction) + flt(ss.total_loan_repayment))))
|
||||||
|
|
||||||
def test_payroll_frequency(self):
|
def test_payroll_frequency(self):
|
||||||
fiscal_year = get_fiscal_year(nowdate(), company=erpnext.get_default_company() or 'Wind Power LLC')[0]
|
fiscal_year = get_fiscal_year(nowdate(), company=erpnext.get_default_company())[0]
|
||||||
month = "%02d" % getdate(nowdate()).month
|
month = "%02d" % getdate(nowdate()).month
|
||||||
m = get_month_details(fiscal_year, month)
|
m = get_month_details(fiscal_year, month)
|
||||||
|
|
||||||
@@ -560,7 +560,7 @@ def create_exemption_declaration(employee, payroll_period):
|
|||||||
"doctype": "Employee Tax Exemption Declaration",
|
"doctype": "Employee Tax Exemption Declaration",
|
||||||
"employee": employee,
|
"employee": employee,
|
||||||
"payroll_period": payroll_period,
|
"payroll_period": payroll_period,
|
||||||
"company": erpnext.get_default_company() or 'Wind Power LLC'
|
"company": erpnext.get_default_company()
|
||||||
})
|
})
|
||||||
declaration.append("declarations", {
|
declaration.append("declarations", {
|
||||||
"exemption_sub_category": "_Test Sub Category",
|
"exemption_sub_category": "_Test Sub Category",
|
||||||
@@ -667,7 +667,7 @@ def create_additional_salary(employee, payroll_period, amount):
|
|||||||
frappe.get_doc({
|
frappe.get_doc({
|
||||||
"doctype": "Additional Salary",
|
"doctype": "Additional Salary",
|
||||||
"employee": employee,
|
"employee": employee,
|
||||||
"company": erpnext.get_default_company() or 'Wind Power LLC',
|
"company": erpnext.get_default_company(),
|
||||||
"salary_component": "Performance Bonus",
|
"salary_component": "Performance Bonus",
|
||||||
"payroll_date": salary_date,
|
"payroll_date": salary_date,
|
||||||
"amount": amount,
|
"amount": amount,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class TestSalaryStructure(unittest.TestCase):
|
|||||||
frappe.db.sql("delete from `tab%s`" % dt)
|
frappe.db.sql("delete from `tab%s`" % dt)
|
||||||
|
|
||||||
self.make_holiday_list()
|
self.make_holiday_list()
|
||||||
frappe.db.set_value("Company", erpnext.get_default_company() or 'Wind Power LLC', "default_holiday_list", "Salary Structure Test Holiday List")
|
frappe.db.set_value("Company", erpnext.get_default_company(), "default_holiday_list", "Salary Structure Test Holiday List")
|
||||||
make_employee("test_employee@salary.com")
|
make_employee("test_employee@salary.com")
|
||||||
make_employee("test_employee_2@salary.com")
|
make_employee("test_employee_2@salary.com")
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ def create_salary_structure_assignment(employee, salary_structure, from_date=Non
|
|||||||
salary_structure_assignment.variable = 5000
|
salary_structure_assignment.variable = 5000
|
||||||
salary_structure_assignment.from_date = from_date or add_days(nowdate(), -1)
|
salary_structure_assignment.from_date = from_date or add_days(nowdate(), -1)
|
||||||
salary_structure_assignment.salary_structure = salary_structure
|
salary_structure_assignment.salary_structure = salary_structure
|
||||||
salary_structure_assignment.company = company or erpnext.get_default_company() or 'Wind Power LLC'
|
salary_structure_assignment.company = company or erpnext.get_default_company()
|
||||||
salary_structure_assignment.save(ignore_permissions=True)
|
salary_structure_assignment.save(ignore_permissions=True)
|
||||||
salary_structure_assignment.income_tax_slab = "Tax Slab: _Test Payroll Period"
|
salary_structure_assignment.income_tax_slab = "Tax Slab: _Test Payroll Period"
|
||||||
salary_structure_assignment.submit()
|
salary_structure_assignment.submit()
|
||||||
|
|||||||
Reference in New Issue
Block a user