fix: Ignore customer and supplier while deleting company transactions (#24279)
* fix: Ignore customer and supplier while deleting company transactions
* fix: Test cases fixed based on Travis
diff --git a/erpnext/accounts/doctype/budget/test_budget.py b/erpnext/accounts/doctype/budget/test_budget.py
index 0f115f9..cd88b11 100644
--- a/erpnext/accounts/doctype/budget/test_budget.py
+++ b/erpnext/accounts/doctype/budget/test_budget.py
@@ -159,10 +159,10 @@
budget = make_budget(budget_against="Cost Center")
month = now_datetime().month
- if month > 10:
- month = 10
+ if month > 9:
+ month = 9
- for i in range(month):
+ for i in range(month+1):
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", posting_date=nowdate(), submit=True)
@@ -181,10 +181,10 @@
budget = make_budget(budget_against="Project")
month = now_datetime().month
- if month > 10:
- month = 10
+ if month > 9:
+ month = 9
- for i in range(month):
+ for i in range(month + 1):
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", posting_date=nowdate(), submit=True, project="_Test Project")
diff --git a/erpnext/payroll/doctype/payroll_entry/test_payroll_entry.py b/erpnext/payroll/doctype/payroll_entry/test_payroll_entry.py
index 54106c8..e098ec7 100644
--- a/erpnext/payroll/doctype/payroll_entry/test_payroll_entry.py
+++ b/erpnext/payroll/doctype/payroll_entry/test_payroll_entry.py
@@ -22,7 +22,7 @@
frappe.db.sql("delete from `tab%s`" % dt)
make_earning_salary_component(setup=True, company_list=["_Test Company"])
- make_deduction_salary_component(setup=True, company_list=["_Test Company"])
+ make_deduction_salary_component(setup=True, test_tax=False, company_list=["_Test Company"])
frappe.db.set_value("Payroll Settings", None, "email_salary_slip_to_employee", 0)
@@ -107,9 +107,9 @@
frappe.db.get_value("Company", "_Test Company", "default_payroll_payable_account") != "_Test Payroll Payable - _TC":
frappe.db.set_value("Company", "_Test Company", "default_payroll_payable_account",
"_Test Payroll Payable - _TC")
-
- make_salary_structure("_Test Salary Structure 1", "Monthly", employee1, company="_Test Company", currency=frappe.db.get_value("Company", "_Test Company", "default_currency"))
- make_salary_structure("_Test Salary Structure 2", "Monthly", employee2, company="_Test Company", currency=frappe.db.get_value("Company", "_Test Company", "default_currency"))
+ currency=frappe.db.get_value("Company", "_Test Company", "default_currency")
+ make_salary_structure("_Test Salary Structure 1", "Monthly", employee1, company="_Test Company", currency=currency, test_tax=False)
+ make_salary_structure("_Test Salary Structure 2", "Monthly", employee2, company="_Test Company", currency=currency, test_tax=False)
dates = get_start_end_dates('Monthly', nowdate())
if not frappe.db.get_value("Salary Slip", {"start_date": dates.start_date, "end_date": dates.end_date}):
diff --git a/erpnext/payroll/doctype/salary_slip/test_salary_slip.py b/erpnext/payroll/doctype/salary_slip/test_salary_slip.py
index bb310c4..d6fb419 100644
--- a/erpnext/payroll/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/payroll/doctype/salary_slip/test_salary_slip.py
@@ -585,14 +585,6 @@
"amount": 200,
"exempted_from_income_tax": 1
- },
- {
- "salary_component": 'TDS',
- "abbr":'T',
- "type": "Deduction",
- "depends_on_payment_days": 0,
- "variable_based_on_taxable_salary": 1,
- "round_to_the_nearest_integer": 1
}
]
if not test_tax:
@@ -603,6 +595,15 @@
"type": "Deduction",
"round_to_the_nearest_integer": 1
})
+ else:
+ data.append({
+ "salary_component": 'TDS',
+ "abbr":'T',
+ "type": "Deduction",
+ "depends_on_payment_days": 0,
+ "variable_based_on_taxable_salary": 1,
+ "round_to_the_nearest_integer": 1
+ })
if setup or test_tax:
make_salary_component(data, test_tax, company_list)
diff --git a/erpnext/setup/doctype/company/delete_company_transactions.py b/erpnext/setup/doctype/company/delete_company_transactions.py
index 566f20c..7a72fe3 100644
--- a/erpnext/setup/doctype/company/delete_company_transactions.py
+++ b/erpnext/setup/doctype/company/delete_company_transactions.py
@@ -28,7 +28,7 @@
"Party Account", "Employee", "Sales Taxes and Charges Template",
"Purchase Taxes and Charges Template", "POS Profile", "BOM",
"Company", "Bank Account", "Item Tax Template", "Mode Of Payment",
- "Item Default"):
+ "Item Default", "Customer", "Supplier"):
delete_for_doctype(doctype, company_name)
# reset company values