[minor] ux fixes

This commit is contained in:
Rushabh Mehta 2017-06-20 09:30:53 +05:30
parent 9a5c39d329
commit 36311020de
3 changed files with 26 additions and 30 deletions

View File

@ -1,9 +1,9 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
cur_frm.add_fetch('employee', 'employee_name', 'employee_name');
frappe.ui.form.on("Timesheet", {
setup: function(frm) {
frm.add_fetch('employee', 'employee_name', 'employee_name');
frm.fields_dict.employee.get_query = function() {
return {
filters:{
@ -51,8 +51,8 @@ frappe.ui.form.on("Timesheet", {
}
if(frm.doc.per_billed > 0) {
cur_frm.fields_dict["time_logs"].grid.toggle_enable("billing_hours", false);
cur_frm.fields_dict["time_logs"].grid.toggle_enable("billable", false);
frm.fields_dict["time_logs"].grid.toggle_enable("billing_hours", false);
frm.fields_dict["time_logs"].grid.toggle_enable("billable", false);
}
},
@ -77,7 +77,7 @@ frappe.ui.form.on("Timesheet Detail", {
},
from_time: function(frm, cdt, cdn) {
calculate_end_time(frm, cdt, cdn)
calculate_end_time(frm, cdt, cdn);
},
to_time: function(frm, cdt, cdn) {
@ -109,18 +109,20 @@ frappe.ui.form.on("Timesheet Detail", {
},
activity_type: function(frm, cdt, cdn) {
var child = locals[cdt][cdn];
frm.script_manager.copy_from_first_row('time_logs', frm.selected_doc,
'project');
frappe.call({
method: "erpnext.projects.doctype.timesheet.timesheet.get_activity_cost",
args: {
employee: frm.doc.employee,
activity_type: child.activity_type
activity_type: frm.selected_doc.activity_type
},
callback: function(r){
if(r.message){
frappe.model.set_value(cdt, cdn, 'billing_rate', r.message['billing_rate']);
frappe.model.set_value(cdt, cdn, 'costing_rate', r.message['costing_rate']);
calculate_billing_costing_amount(frm, cdt, cdn)
calculate_billing_costing_amount(frm, cdt, cdn);
}
}
})
@ -174,8 +176,8 @@ var calculate_time_and_amount = function(frm) {
}
}
cur_frm.set_value("total_billable_hours", total_billing_hr);
cur_frm.set_value("total_hours", total_working_hr);
cur_frm.set_value("total_billable_amount", total_billable_amount);
cur_frm.set_value("total_costing_amount", total_costing_amount);
frm.set_value("total_billable_hours", total_billing_hr);
frm.set_value("total_hours", total_working_hr);
frm.set_value("total_billable_amount", total_billable_amount);
frm.set_value("total_costing_amount", total_costing_amount);
}

View File

@ -602,8 +602,10 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
toggle_conversion_factor: function(item) {
// toggle read only property for conversion factor field if the uom and stock uom are same
if(this.frm.get_field('items').grid.fields_map.conversion_factor) {
this.frm.fields_dict.items.grid.toggle_enable("conversion_factor",
(item.uom != item.stock_uom)? true: false)
(item.uom != item.stock_uom)? true: false);
}
},
qty: function(doc, cdt, cdn) {

View File

@ -30,11 +30,15 @@ frappe.ui.form.on('Material Request', {
});
frappe.ui.form.on("Material Request Item", {
"qty": function (frm, doctype, name) {
qty: function (frm, doctype, name) {
var d = locals[doctype][name];
if (flt(d.qty) < flt(d.min_order_qty)) {
frappe.msgprint(__("Warning: Material Requested Qty is less than Minimum Order Qty"));
}
},
item_code: function(frm, doctype, name) {
frm.script_manager.copy_from_first_row('items', frm.selected_doc,
'schedule_date');
}
});
@ -118,18 +122,6 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
},
schedule_date: function(doc, cdt, cdn) {
var val = locals[cdt][cdn].schedule_date;
if(val) {
$.each((doc.items || []), function(i, d) {
if(!d.schedule_date) {
d.schedule_date = val;
}
});
refresh_field("items");
}
},
get_items_from_bom: function() {
var d = new frappe.ui.Dialog({
title: __("Get Items from BOM"),