restructuring timesheet fields

This commit is contained in:
Anupam 2021-05-19 14:58:12 +05:30
parent 9bd779401d
commit 4e73c8a79f
2 changed files with 46 additions and 10 deletions

View File

@ -145,14 +145,20 @@ frappe.ui.form.on("Timesheet", {
let base_currency = frappe.defaults.get_global_default('currency');
frm.set_currency_labels(["base_total_costing_amount", "base_total_billable_amount", "base_total_billed_amount"], base_currency);
frm.set_currency_labels(["total_costing_amount", "total_billable_amount", "total_billed_amount"], frm.doc.currency);
frm.set_currency_labels(["base_billing_rate", "base_billing_amount", "base_costing_rate", "base_costing_amount"], base_currency, "time_logs");
frm.set_currency_labels(["billing_rate", "billing_amount", "costing_rate", "costing_amount"], frm.doc.currency, "time_logs");
let time_logs_grid = frm.fields_dict.time_logs.grid;
$.each(["base_billing_rate", "base_billing_amount", "base_costing_rate", "base_costing_amount"], function(i, d) {
if(frappe.meta.get_docfield(time_logs_grid.doctype, d))
time_logs_grid.set_column_disp(d, frm.doc.currency != base_currency);
});
frm.toggle_display(["base_total_costing_amount", "base_total_billable_amount", "base_total_billed_amount"],
frm.doc.currency != base_currency)
if (frm.doc?.time_logs.length > 0) {
frm.set_currency_labels(["base_billing_rate", "base_billing_amount", "base_costing_rate", "base_costing_amount"], base_currency, "time_logs");
frm.set_currency_labels(["billing_rate", "billing_amount", "costing_rate", "costing_amount"], frm.doc.currency, "time_logs");
let time_logs_grid = frm.fields_dict.time_logs.grid;
$.each(["base_billing_rate", "base_billing_amount", "base_costing_rate", "base_costing_amount"], function(i, d) {
if (frappe.meta.get_docfield(time_logs_grid.doctype, d))
time_logs_grid.set_column_disp(d, frm.doc.currency != base_currency);
});
}
frm.refresh_fields();
},

View File

@ -13,6 +13,7 @@
"company",
"customer",
"currency",
"exchange_rate",
"sales_invoice",
"column_break_3",
"salary_slip",
@ -32,11 +33,14 @@
"total_hours",
"billing_details",
"total_billable_hours",
"total_billed_hours",
"total_costing_amount",
"base_total_billable_amount",
"base_total_billed_amount",
"base_total_costing_amount",
"column_break_10",
"total_billed_hours",
"total_billable_amount",
"total_billed_amount",
"total_costing_amount",
"per_billed",
"section_break_18",
"note",
@ -283,13 +287,39 @@
"fieldtype": "Link",
"label": "Currency",
"options": "Currency"
},
{
"fieldname": "base_total_costing_amount",
"fieldtype": "Currency",
"label": "Total Costing Amount",
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "base_total_billable_amount",
"fieldtype": "Currency",
"label": "Total Billable Amount",
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "base_total_billed_amount",
"fieldtype": "Currency",
"label": "Total Billed Amount",
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "exchange_rate",
"fieldtype": "Float",
"label": "Exchange Rate"
}
],
"icon": "fa fa-clock-o",
"idx": 1,
"is_submittable": 1,
"links": [],
"modified": "2021-05-13 17:13:29.954960",
"modified": "2021-05-18 16:10:08.249619",
"modified_by": "Administrator",
"module": "Projects",
"name": "Timesheet",