Time Log Batch creation from time log list

This commit is contained in:
Nabin Hait 2014-05-06 11:58:00 +05:30
parent cea4cd4e5f
commit b1285f9fce
2 changed files with 14 additions and 12 deletions

View File

@ -2,7 +2,7 @@
"allow_attach": 1,
"allow_import": 1,
"autoname": "naming_series:",
"creation": "2013-04-03 16:38:41.000000",
"creation": "2013-04-03 16:38:41",
"description": "Log of Activities performed by users against Tasks that can be used for tracking time, billing.",
"docstatus": 0,
"doctype": "DocType",
@ -29,7 +29,7 @@
{
"fieldname": "to_time",
"fieldtype": "Datetime",
"in_list_view": 0,
"in_list_view": 1,
"label": "To Time",
"permlevel": 0,
"read_only": 0,
@ -38,6 +38,7 @@
{
"fieldname": "hours",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Hours",
"permlevel": 0,
"read_only": 1
@ -151,7 +152,7 @@
"icon": "icon-time",
"idx": 1,
"is_submittable": 1,
"modified": "2014-01-22 16:05:35.000000",
"modified": "2014-05-06 11:53:04.133874",
"modified_by": "Administrator",
"module": "Projects",
"name": "Time Log",

View File

@ -10,9 +10,10 @@ frappe.listview_settings['Time Log'] = {
var selected = me.get_checked_items() || [];
if(!selected.length) {
msgprint(__("Please select Time Logs."))
msgprint(__("Please select Time Logs."));
return;
}
// select only billable time logs
for(var i in selected) {
var d = selected[i];
@ -22,27 +23,27 @@ frappe.listview_settings['Time Log'] = {
}
if(d.status!="Submitted") {
msgprint(__("Time Log Status must be Submitted."));
return
}
}
// make batch
frappe.model.with_doctype("Time Log Batch", function() {
var tlb = frappe.model.get_new_doc("Time Log Batch");
$.each(selected, function(i, d) {
var detail = frappe.model.get_new_doc("Time Log Batch Detail");
var detail = frappe.model.get_new_doc("Time Log Batch Detail", tlb,
"time_log_batch_details");
$.extend(detail, {
"parenttype": "Time Log Batch",
"parentfield": "time_log_batch_details",
"parent": tlb.name,
"time_log": d.name,
"activity_type": d.activity_type,
"created_by": d.owner,
"idx": i+1
"hours": d.hours
});
})
frappe.set_route("Form", "Time Log Batch", tlb.name);
})
}, "icon-file-alt");
}
};