[minor] ux fixes
This commit is contained in:
parent
9a5c39d329
commit
36311020de
@ -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);
|
||||
}
|
@ -16,11 +16,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
// or set discount
|
||||
item.discount_percentage = 0;
|
||||
item.margin_type = 'Amount';
|
||||
item.margin_rate_or_amount = flt(item.rate - item.price_list_rate,
|
||||
item.margin_rate_or_amount = flt(item.rate - item.price_list_rate,
|
||||
precision("margin_rate_or_amount", item));
|
||||
item.rate_with_margin = item.rate;
|
||||
} else {
|
||||
item.discount_percentage = flt((1 - item.rate / item.price_list_rate) * 100.0,
|
||||
item.discount_percentage = flt((1 - item.rate / item.price_list_rate) * 100.0,
|
||||
precision("discount_percentage", item));
|
||||
item.margin_type = '';
|
||||
item.margin_rate_or_amount = 0;
|
||||
@ -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
|
||||
this.frm.fields_dict.items.grid.toggle_enable("conversion_factor",
|
||||
(item.uom != item.stock_uom)? true: false)
|
||||
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);
|
||||
}
|
||||
},
|
||||
|
||||
qty: function(doc, cdt, cdn) {
|
||||
@ -756,7 +758,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
if(this.frm.doc.ignore_pricing_rule) {
|
||||
var me = this;
|
||||
var item_list = [];
|
||||
|
||||
|
||||
$.each(this.frm.doc["items"] || [], function(i, d) {
|
||||
if (d.item_code) {
|
||||
item_list.push({
|
||||
@ -1144,7 +1146,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
|
||||
if(!item.item_code) {
|
||||
frappe.throw(__("Please enter Item Code to get batch no"));
|
||||
} else if (doc.doctype == "Purchase Receipt" ||
|
||||
} else if (doc.doctype == "Purchase Receipt" ||
|
||||
(doc.doctype == "Purchase Invoice" && doc.update_stock)) {
|
||||
|
||||
return {
|
||||
|
@ -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"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user