mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 10:11:20 +00:00
Merge pull request #6572 from RobertSchouten/patch-33
[fix] update timestamps and relink communication for timesheet
This commit is contained in:
@@ -318,3 +318,4 @@ 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("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)")
|
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
|
erpnext.patches.v7_0.update_mode_of_payment_type
|
||||||
|
finally:erpnext.patches.v7_0.update_timesheet_communications
|
||||||
|
|||||||
23
erpnext/patches/v7_0/update_timesheet_communications
Normal file
23
erpnext/patches/v7_0/update_timesheet_communications
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
if frappe.db.table_exists("Time Log"):
|
||||||
|
timesheet = frappe.db.sql("""SELECT ts.name AS name, tl.name AS timelogname,
|
||||||
|
tl.modified AS modified, tl.modified_by AS modified_by, tl.creation AS creation, tl.owner AS owner
|
||||||
|
FROM
|
||||||
|
`tabTimesheet` ts, `tabTimesheet Detail` tsd, `tabTime Log` tl
|
||||||
|
WHERE
|
||||||
|
tsd.parent = ts.name AND tl.from_time = tsd.from_time AND tl.to_time = tsd.to_time
|
||||||
|
AND tl.hours = tsd.hours AND tl.billing_rate = tsd.billing_rate AND tsd.idx=1
|
||||||
|
AND tl.docstatus < 2""", as_dict=1)
|
||||||
|
|
||||||
|
for data in timesheet:
|
||||||
|
frappe.db.sql("""
|
||||||
|
update
|
||||||
|
tabCommunication
|
||||||
|
set
|
||||||
|
reference_doctype = "Timesheet", reference_name = %(timesheet)s
|
||||||
|
where
|
||||||
|
reference_doctype = "Time Log" and reference_name = %(timelog)s
|
||||||
|
""", {'timesheet': data.name, 'timelog': data.timelogname}, auto_commit=1)
|
||||||
Reference in New Issue
Block a user