[Fix] Timesheet employee is missing in patch
This commit is contained in:
parent
16e15283b5
commit
7f165f19d2
@ -311,4 +311,5 @@ erpnext.patches.v7_0.rename_examination_to_assessment
|
||||
erpnext.patches.v7_0.set_portal_settings
|
||||
erpnext.patches.v7_0.repost_future_gle_for_purchase_invoice
|
||||
erpnext.patches.v7_0.fix_duplicate_icons
|
||||
erpnext.patches.v7_0.repost_gle_for_pos_sales_return
|
||||
erpnext.patches.v7_0.repost_gle_for_pos_sales_return
|
||||
erpnext.patches.v7_0.update_missing_employee_in_timesheet
|
@ -16,6 +16,7 @@ def execute():
|
||||
time_sheet = make_timesheet(data.production_order)
|
||||
args = get_timelog_data(data)
|
||||
add_timesheet_detail(time_sheet, args)
|
||||
time_sheet.employee = data.employee
|
||||
time_sheet.note = data.note
|
||||
time_sheet.company = company
|
||||
|
||||
|
19
erpnext/patches/v7_0/update_missing_employee_in_timesheet.py
Normal file
19
erpnext/patches/v7_0/update_missing_employee_in_timesheet.py
Normal file
@ -0,0 +1,19 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
timesheet = frappe.db.sql("""select tl.employee as employee, ts.name as name,
|
||||
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 and (ts.employee = '' or ts.employee is null)""", as_dict=1)
|
||||
|
||||
for data in timesheet:
|
||||
ts_doc = frappe.get_doc('Timesheet', data.name)
|
||||
if len(ts_doc.time_logs) == 1:
|
||||
frappe.db.sql(""" update `tabTimesheet` set creation = %(creation)s,
|
||||
owner = %(owner)s, modified = %(modified)s, modified_by = %(modified_by)s,
|
||||
employee = %(employee)s where name = %(name)s""", data)
|
@ -16,6 +16,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
@ -41,6 +42,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
@ -67,6 +69,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "",
|
||||
"description": "",
|
||||
"fieldname": "sales_invoice",
|
||||
@ -94,6 +97,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
@ -117,6 +121,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "",
|
||||
"fieldname": "salary_slip",
|
||||
"fieldtype": "Link",
|
||||
@ -144,6 +149,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "Draft",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
@ -171,7 +177,8 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"collapsible_depends_on": "",
|
||||
"depends_on": "eval:!doc.production_order",
|
||||
"columns": 0,
|
||||
"depends_on": "eval:!doc.production_order || doc.docstatus == 1",
|
||||
"fieldname": "employee_detail",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
@ -197,6 +204,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "",
|
||||
"description": "List of employee which has \"Salary Slip Based on Timesheet\" is enabled in salary structure.",
|
||||
"fieldname": "employee",
|
||||
@ -225,6 +233,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "employee",
|
||||
"fieldname": "employee_name",
|
||||
"fieldtype": "Data",
|
||||
@ -252,6 +261,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "user",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
@ -278,6 +288,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_9",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
@ -302,6 +313,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "start_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
@ -327,6 +339,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "end_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
@ -353,6 +366,7 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"collapsible_depends_on": "",
|
||||
"columns": 0,
|
||||
"depends_on": "production_order",
|
||||
"fieldname": "production_detail",
|
||||
"fieldtype": "Section Break",
|
||||
@ -379,6 +393,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "production_order",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
@ -405,6 +420,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "section_break_5",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
@ -428,6 +444,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "time_logs",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
@ -453,6 +470,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "section_break_8",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
@ -477,6 +495,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"description": "",
|
||||
"fieldname": "total_hours",
|
||||
@ -503,6 +522,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_10",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
@ -527,6 +547,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"depends_on": "",
|
||||
"description": "",
|
||||
@ -555,6 +576,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "total_costing_amount",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
@ -580,6 +602,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "section_break_18",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
@ -604,6 +627,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "note",
|
||||
"fieldtype": "Text Editor",
|
||||
"hidden": 0,
|
||||
@ -629,6 +653,7 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
@ -662,7 +687,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-08-01 08:54:31.840829",
|
||||
"modified": "2016-09-01 11:33:38.110421",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Timesheet",
|
||||
|
Loading…
x
Reference in New Issue
Block a user