[Fix] Timesheet detail records not deleted with company transactions deletion

This commit is contained in:
Rohit Waghchaure 2016-09-29 01:07:28 +05:30
parent a82358bb98
commit 17adb970f1
2 changed files with 1 additions and 9 deletions

View File

@ -315,4 +315,5 @@ erpnext.patches.v7_0.update_missing_employee_in_timesheet
erpnext.patches.v7_0.update_status_for_timesheet
erpnext.patches.v7_0.set_party_name_in_payment_entry
execute:frappe.db.sql("update `tabTimesheet` ts, `tabEmployee` emp set ts.employee_name = emp.employee_name where emp.name = ts.employee and ts.employee_name is null and ts.employee is not null")
execute:frappe.db.sql("delete from `tabTimesheet Detail` where NOT EXISTS (select name from `tabTimesheet` where name = `tabTimesheet Detail`.parent)")
erpnext.patches.v7_0.update_mode_of_payment_type

View File

@ -18,7 +18,6 @@ def delete_company_transactions(company_name):
frappe.PermissionError)
delete_bins(company_name)
delete_time_sheets(company_name)
delete_lead_addresses(company_name)
for doctype in frappe.db.sql_list("""select parent from
@ -70,14 +69,6 @@ def delete_bins(company_name):
frappe.db.sql("""delete from tabBin where warehouse in
(select name from tabWarehouse where company=%s)""", company_name)
def delete_time_sheets(company_name):
# Delete Time Logs as it is linked to Production Order / Project / Task, which are linked to company
frappe.db.sql("""
delete from `tabTimesheet`
where
company=%(company)s
""", {"company": company_name})
def delete_lead_addresses(company_name):
"""Delete addresses to which leads are linked"""
for lead in frappe.get_all("Lead", filters={"company": company_name}):