mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-13 20:05:09 +00:00
fix(projects): Remove hardcode of expected end date for new Tasks (#17716)
This commit is contained in:
@@ -19,43 +19,38 @@ frappe.ui.form.on("Task", {
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
frm.fields_dict['parent_task'].get_query = function() {
|
||||
frm.fields_dict['parent_task'].get_query = function () {
|
||||
return {
|
||||
filters: {
|
||||
"is_group": 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!frm.is_group){
|
||||
var doc = frm.doc;
|
||||
if(doc.__islocal) {
|
||||
if(!frm.doc.exp_end_date) {
|
||||
frm.set_value("exp_end_date", frappe.datetime.add_days(new Date(), 7));
|
||||
}
|
||||
}
|
||||
|
||||
if(!doc.__islocal) {
|
||||
if(frappe.model.can_read("Timesheet")) {
|
||||
frm.add_custom_button(__("Timesheet"), function() {
|
||||
frappe.route_options = {"project": doc.project, "task": doc.name}
|
||||
if (!frm.doc.is_group) {
|
||||
if (!frm.is_new()) {
|
||||
if (frappe.model.can_read("Timesheet")) {
|
||||
frm.add_custom_button(__("Timesheet"), () => {
|
||||
frappe.route_options = { "project": frm.doc.project, "task": frm.doc.name }
|
||||
frappe.set_route("List", "Timesheet");
|
||||
}, __("View"), true);
|
||||
}
|
||||
if(frappe.model.can_read("Expense Claim")) {
|
||||
frm.add_custom_button(__("Expense Claims"), function() {
|
||||
frappe.route_options = {"project": doc.project, "task": doc.name}
|
||||
|
||||
if (frappe.model.can_read("Expense Claim")) {
|
||||
frm.add_custom_button(__("Expense Claims"), () => {
|
||||
frappe.route_options = { "project": frm.doc.project, "task": frm.doc.name }
|
||||
frappe.set_route("List", "Expense Claim");
|
||||
}, __("View"), true);
|
||||
}
|
||||
|
||||
if(frm.perm[0].write) {
|
||||
if(frm.doc.status!=="Closed" && frm.doc.status!=="Cancelled") {
|
||||
frm.add_custom_button(__("Close"), function() {
|
||||
if (frm.perm[0].write) {
|
||||
if (!["Closed", "Cancelled"].includes(frm.doc.status)) {
|
||||
frm.add_custom_button(__("Close"), () => {
|
||||
frm.set_value("status", "Closed");
|
||||
frm.save();
|
||||
});
|
||||
} else {
|
||||
frm.add_custom_button(__("Reopen"), function() {
|
||||
frm.add_custom_button(__("Reopen"), () => {
|
||||
frm.set_value("status", "Open");
|
||||
frm.save();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user