[Fix] Time sheet rename issues
This commit is contained in:
parent
391c0efcee
commit
3e012b7e16
@ -450,7 +450,7 @@ frappe.ui.form.on('Sales Invoice', {
|
|||||||
frm.fields_dict["timesheets"].grid.get_field("time_sheet").get_query = function(doc, cdt, cdn){
|
frm.fields_dict["timesheets"].grid.get_field("time_sheet").get_query = function(doc, cdt, cdn){
|
||||||
return {
|
return {
|
||||||
filters: [
|
filters: [
|
||||||
["Time Sheet", "status", "in", ["Submitted", "Payslip"]]
|
["Timesheet", "status", "in", ["Submitted", "Payslip"]]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ def get_data():
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doctype",
|
"type": "doctype",
|
||||||
"name": "Time Sheet",
|
"name": "Timesheet",
|
||||||
"description": _("Time Sheet for manufacturing."),
|
"description": _("Time Sheet for manufacturing."),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
from erpnext.manufacturing.doctype.production_order.production_order import make_time_sheet, add_timesheet_detail
|
from erpnext.manufacturing.doctype.production_order.production_order import make_timesheet, add_timesheet_detail
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
for data in frappe.get_all('Time Log', fields=["*"],
|
for data in frappe.get_all('Time Log', fields=["*"],
|
||||||
filters = [["docstatus", "<", "2"]]):
|
filters = [["docstatus", "<", "2"]]):
|
||||||
time_sheet = make_time_sheet(data.production_order)
|
time_sheet = make_timesheet(data.production_order)
|
||||||
args = get_timesheet_data(data)
|
args = get_timesheet_data(data)
|
||||||
add_timesheet_detail(time_sheet, args)
|
add_timesheet_detail(time_sheet, args)
|
||||||
time_sheet.docstatus = data.docstatus
|
time_sheet.docstatus = data.docstatus
|
||||||
|
@ -80,7 +80,7 @@ frappe.ui.form.on("Project", {
|
|||||||
|
|
||||||
section.on('click', '.time-sheet-link', function() {
|
section.on('click', '.time-sheet-link', function() {
|
||||||
var activity_type = $(this).attr('data-activity_type');
|
var activity_type = $(this).attr('data-activity_type');
|
||||||
frappe.set_route('List', 'Time Sheet',
|
frappe.set_route('List', 'Timesheet',
|
||||||
{'activity_type': activity_type, 'project': frm.doc.name});
|
{'activity_type': activity_type, 'project': frm.doc.name});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,10 @@ frappe.ui.form.on("Task", {
|
|||||||
|
|
||||||
|
|
||||||
if(!doc.__islocal) {
|
if(!doc.__islocal) {
|
||||||
if(frappe.model.can_read("Time Sheet")) {
|
if(frappe.model.can_read("Timesheet")) {
|
||||||
frm.add_custom_button(__("Time Sheet"), function() {
|
frm.add_custom_button(__("Timesheet"), function() {
|
||||||
frappe.route_options = {"project": doc.project, "task": doc.name}
|
frappe.route_options = {"project": doc.project, "task": doc.name}
|
||||||
frappe.set_route("List", "Time Sheet");
|
frappe.set_route("List", "Timesheet");
|
||||||
}, __("View"), true);
|
}, __("View"), true);
|
||||||
}
|
}
|
||||||
if(frappe.model.can_read("Expense Claim")) {
|
if(frappe.model.can_read("Expense Claim")) {
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
|
||||||
// For license information, please see license.txt
|
|
||||||
|
|
||||||
frappe.query_reports["Daily Time Sheet Summary"] = {
|
|
||||||
"filters": [
|
|
||||||
{
|
|
||||||
"fieldname":"from_date",
|
|
||||||
"label": __("From Date"),
|
|
||||||
"fieldtype": "Date",
|
|
||||||
"default": frappe.datetime.get_today()
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname":"to_date",
|
|
||||||
"label": __("To Date"),
|
|
||||||
"fieldtype": "Date",
|
|
||||||
"default": frappe.datetime.get_today()
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"add_total_row": 0,
|
|
||||||
"apply_user_permissions": 1,
|
|
||||||
"creation": "2016-06-25 01:52:25.911238",
|
|
||||||
"disabled": 0,
|
|
||||||
"docstatus": 0,
|
|
||||||
"doctype": "Report",
|
|
||||||
"idx": 0,
|
|
||||||
"is_standard": "Yes",
|
|
||||||
"modified": "2016-06-25 01:52:31.214122",
|
|
||||||
"modified_by": "Administrator",
|
|
||||||
"module": "Projects",
|
|
||||||
"name": "Daily Time Sheet Summary",
|
|
||||||
"owner": "Administrator",
|
|
||||||
"ref_doctype": "Time Sheet",
|
|
||||||
"report_name": "Daily Time Sheet Summary",
|
|
||||||
"report_type": "Script Report"
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
|
||||||
# For license information, please see license.txt
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
import frappe
|
|
||||||
from frappe import _
|
|
||||||
|
|
||||||
def execute(filters=None):
|
|
||||||
if not filters:
|
|
||||||
filters = {}
|
|
||||||
elif filters.get("from_date") or filters.get("to_date"):
|
|
||||||
filters["from_time"] = "00:00:00"
|
|
||||||
filters["to_time"] = "24:00:00"
|
|
||||||
|
|
||||||
columns = [_("Timesheet") + ":Link/Timesheet:120", _("Employee") + "::150", _("From Datetime") + "::140",
|
|
||||||
_("To Datetime") + "::140", _("Hours") + "::70", _("Activity Type") + "::120", _("Task") + ":Link/Task:150",
|
|
||||||
_("Project") + ":Link/Project:120", _("Status") + "::70"]
|
|
||||||
|
|
||||||
conditions = "ts.docstatus = 1"
|
|
||||||
if filters.get("from_date"):
|
|
||||||
conditions += " and tsd.from_time >= timestamp(%(from_date)s, %(from_time)s)"
|
|
||||||
if filters.get("to_date"):
|
|
||||||
conditions += " and tsd.to_time <= timestamp(%(to_date)s, %(to_time)s)"
|
|
||||||
|
|
||||||
data = get_data(conditions, filters)
|
|
||||||
|
|
||||||
return columns, data
|
|
||||||
|
|
||||||
def get_data(conditions, filters):
|
|
||||||
time_sheet = frappe.db.sql(""" select ts.name, ts.employee, tsd.from_time, tsd.to_time, tsd.hours,
|
|
||||||
tsd.activity_type, tsd.task, tsd.project, ts.status from `tabTimesheet Detail` tsd,
|
|
||||||
`tabTimesheet` ts where ts.name = tsd.parent and %s order by ts.name"""%(conditions), filters, as_list=1)
|
|
||||||
|
|
||||||
return time_sheet
|
|
Loading…
x
Reference in New Issue
Block a user