brotherton-erpnext/erpnext/patches/v7_0/update_status_for_timesheet.py
2016-09-02 12:24:54 +05:30

11 lines
413 B
Python

from __future__ import unicode_literals
import frappe
def execute():
frappe.db.sql("""update
`tabTimesheet` as ts,
(
select min(from_time)as from_time, max(to_time) as to_time, parent from `tabTimesheet Detail` group by parent
) as tsd
set ts.status = 'Submitted', ts.start_date = tsd.from_time, ts.end_date = tsd.to_time
where tsd.parent = ts.name and ts.status = 'Draft' and ts.docstatus =1""")