brotherton-erpnext/erpnext/patches/v7_0/update_status_for_timesheet.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
413 B
Python
Raw Normal View History

2016-09-02 06:54:54 +00:00
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""")