refactor: suggested changes
This commit is contained in:
parent
0b02f1335f
commit
6fb218e033
@ -67,7 +67,7 @@ erpnext.maintenance.MaintenanceSchedule = frappe.ui.form.Controller.extend({
|
||||
let schedules = me.frm.doc.schedules;
|
||||
let flag = schedules.some(schedule => schedule.completion_status === "Pending");
|
||||
if (flag) {
|
||||
this.frm.add_custom_button(__('Create Maintenance Visit'), function () {
|
||||
this.frm.add_custom_button(__('Maintenance Visit'), function () {
|
||||
let options = "";
|
||||
|
||||
me.frm.call('get_pending_data', {data_type: "items"}).then(r => {
|
||||
|
@ -20,6 +20,7 @@ class MaintenanceVisit(TransactionBase):
|
||||
def validate_maintenance_date(self):
|
||||
if self.maintenance_type == "Scheduled" and self.maintenance_schedule_detail:
|
||||
item_ref = frappe.db.get_value('Maintenance Schedule Detail', self.maintenance_schedule_detail, 'item_reference')
|
||||
if item_ref:
|
||||
start_date, end_date = frappe.db.get_value('Maintenance Schedule Item', item_ref, ['start_date', 'end_date'])
|
||||
if get_datetime(self.mntc_date) < get_datetime(start_date) or get_datetime(self.mntc_date) > get_datetime(end_date):
|
||||
frappe.throw(_("Date must be between {0} and {1}").format(start_date, end_date))
|
||||
|
Loading…
x
Reference in New Issue
Block a user