fixes in Time Log Batch

This commit is contained in:
Neil Trini Lasrado 2015-04-21 15:05:37 +05:30
parent 086c0463be
commit 832dfe7980
3 changed files with 15 additions and 3 deletions

View File

@ -3,7 +3,7 @@
// render
frappe.listview_settings['Time Log'] = {
add_fields: ["status", "billable", "activity_type", "task", "project", "hours", "for_manufacturing"],
add_fields: ["status", "billable", "activity_type", "task", "project", "hours", "for_manufacturing", "billing_amount"],
selectable: true,
onload: function(me) {
me.page.add_menu_item(__("Make Time Log Batch"), function() {
@ -37,7 +37,7 @@ frappe.listview_settings['Time Log'] = {
$.extend(detail, {
"time_log": d.name,
"activity_type": d.activity_type,
"created_by": d.owner,
"billing_amount": d.billing_amount,
"hours": d.hours
});
})

View File

@ -36,3 +36,15 @@ $.extend(cur_frm.cscript, {
});
}
});
frappe.ui.form.on("Time Log Batch Detail", "time_log", function(frm, cdt, cdn) {
var tl = frm.doc.time_logs || [];
total_hr = 0;
total_amt = 0;
for(var i=0; i<tl.length; i++) {
total_hr += tl[i].hours;
total_amt += tl[i].billing_amount;
}
cur_frm.set_value("total_hours", total_hr);
cur_frm.set_value("total_billing_amount", total_amt);
});

View File

@ -26,7 +26,7 @@ class TimeLogBatch(Document):
d.update({
"hours": tl.hours,
"activity_type": tl.activity_type,
"created_by": tl.owner
"billing_amount": tl.billing_amount
})
def validate_time_log_is_submitted(self, tl):