From d583e412c9fab0c12993852073126b07c39d8ac4 Mon Sep 17 00:00:00 2001 From: 0Pranav Date: Tue, 22 Oct 2019 12:33:09 +0530 Subject: [PATCH 1/9] Add generic 'Appointment' doctype --- .../doctype/appointment/__init__.py | 0 .../doctype/appointment/appointment.js | 8 ++ .../doctype/appointment/appointment.json | 103 ++++++++++++++++++ .../doctype/appointment/appointment.py | 10 ++ .../doctype/appointment/test_appointment.py | 10 ++ 5 files changed, 131 insertions(+) create mode 100644 erpnext/communication/doctype/appointment/__init__.py create mode 100644 erpnext/communication/doctype/appointment/appointment.js create mode 100644 erpnext/communication/doctype/appointment/appointment.json create mode 100644 erpnext/communication/doctype/appointment/appointment.py create mode 100644 erpnext/communication/doctype/appointment/test_appointment.py diff --git a/erpnext/communication/doctype/appointment/__init__.py b/erpnext/communication/doctype/appointment/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/communication/doctype/appointment/appointment.js b/erpnext/communication/doctype/appointment/appointment.js new file mode 100644 index 00000000000..4e41047fa11 --- /dev/null +++ b/erpnext/communication/doctype/appointment/appointment.js @@ -0,0 +1,8 @@ +// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Appointment', { + // refresh: function(frm) { + + // } +}); diff --git a/erpnext/communication/doctype/appointment/appointment.json b/erpnext/communication/doctype/appointment/appointment.json new file mode 100644 index 00000000000..7d808486abc --- /dev/null +++ b/erpnext/communication/doctype/appointment/appointment.json @@ -0,0 +1,103 @@ +{ + "autoname": "APMT.#####", + "creation": "2019-10-22 12:06:17.491113", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "start_time", + "appointment_duration", + "timezone", + "atendees_section", + "requester_type", + "requester", + "col_br_1", + "invitee_type", + "invitee" + ], + "fields": [ + { + "fieldname": "start_time", + "fieldtype": "Datetime", + "in_list_view": 1, + "label": "Start Time", + "reqd": 1 + }, + { + "fieldname": "appointment_duration", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Duration in minutes", + "reqd": 1 + }, + { + "fieldname": "requester", + "fieldtype": "Dynamic Link", + "in_list_view": 1, + "label": "Appointment Requester ", + "options": "requester_type", + "reqd": 1 + }, + { + "fieldname": "invitee", + "fieldtype": "Dynamic Link", + "in_list_view": 1, + "label": "Appointment Invitee", + "options": "invitee_type", + "reqd": 1 + }, + { + "fieldname": "timezone", + "fieldtype": "Data", + "label": "Requester's Timezone", + "reqd": 1 + }, + { + "fieldname": "atendees_section", + "fieldtype": "Section Break", + "label": "Atendees" + }, + { + "fieldname": "requester_type", + "fieldtype": "Link", + "label": "Requester Type", + "options": "DocType", + "reqd": 1 + }, + { + "fieldname": "col_br_1", + "fieldtype": "Column Break" + }, + { + "fieldname": "invitee_type", + "fieldtype": "Link", + "label": "Invitee Type", + "options": "DocType", + "reqd": 1 + } + ], + "modified": "2019-10-22 12:18:20.719128", + "modified_by": "Administrator", + "module": "Communication", + "name": "Appointment", + "name_case": "UPPER CASE", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 +} \ No newline at end of file diff --git a/erpnext/communication/doctype/appointment/appointment.py b/erpnext/communication/doctype/appointment/appointment.py new file mode 100644 index 00000000000..204b066031b --- /dev/null +++ b/erpnext/communication/doctype/appointment/appointment.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +# import frappe +from frappe.model.document import Document + +class Appointment(Document): + pass diff --git a/erpnext/communication/doctype/appointment/test_appointment.py b/erpnext/communication/doctype/appointment/test_appointment.py new file mode 100644 index 00000000000..702ac7176fb --- /dev/null +++ b/erpnext/communication/doctype/appointment/test_appointment.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals + +# import frappe +import unittest + +class TestAppointment(unittest.TestCase): + pass From abbc08cb486105d9dbedfc2a57aede39c2303f25 Mon Sep 17 00:00:00 2001 From: 0Pranav Date: Wed, 30 Oct 2019 10:46:16 +0530 Subject: [PATCH 2/9] fix: hide generate schedule button on new forms --- .../doctype/maintenance_schedule/maintenance_schedule.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js index ce95db3bf5a..f2fc588be49 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js +++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js @@ -20,6 +20,12 @@ frappe.ui.form.on('Maintenance Schedule', { frm.set_value({transaction_date: frappe.datetime.get_today()}); } }, + refresh: function(frm) { + setTimeout(()=> { + debugger; + frm.toggle_display('generate_schedule',!(frm.is_new())); + },10); + }, customer: function(frm) { erpnext.utils.get_party_details(frm) }, From d2d0100c9a6958a7694af0575176bef497d81cd3 Mon Sep 17 00:00:00 2001 From: 0Pranav Date: Wed, 30 Oct 2019 10:48:13 +0530 Subject: [PATCH 3/9] fix:better error message when sales person is none --- .../doctype/maintenance_schedule/maintenance_schedule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py index 3a64e1aa67a..1ad7fc85523 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py +++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py @@ -150,7 +150,7 @@ class MaintenanceSchedule(TransactionBase): elif not d.no_of_visits: throw(_("Please mention no of visits required")) elif not d.sales_person: - throw(_("Please select Incharge Person's name")) + throw(_("Please select Incharge Person's name for item: {0}".format(d.item_name))) if getdate(d.start_date) >= getdate(d.end_date): throw(_("Start date should be less than end date for Item {0}").format(d.item_code)) From 846c03889ef5a39a824b059d1924249e59b9e9ca Mon Sep 17 00:00:00 2001 From: 0Pranav Date: Wed, 30 Oct 2019 10:51:25 +0530 Subject: [PATCH 4/9] fix: hide schedule section on new forms --- .../doctype/maintenance_schedule/maintenance_schedule.js | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js index f2fc588be49..e91f478aa49 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js +++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js @@ -24,6 +24,7 @@ frappe.ui.form.on('Maintenance Schedule', { setTimeout(()=> { debugger; frm.toggle_display('generate_schedule',!(frm.is_new())); + frm.toggle_display('schedule',!(frm.is_new())); },10); }, customer: function(frm) { From 0f0d6ce25cf2a44f18a4300d3ab0e31c2a4d6c06 Mon Sep 17 00:00:00 2001 From: 0Pranav Date: Wed, 30 Oct 2019 11:08:09 +0530 Subject: [PATCH 5/9] Remove doctype related to appointment scheduling --- .../doctype/appointment/__init__.py | 0 .../doctype/appointment/appointment.js | 8 -- .../doctype/appointment/appointment.json | 103 ------------------ .../doctype/appointment/appointment.py | 10 -- .../doctype/appointment/test_appointment.py | 10 -- 5 files changed, 131 deletions(-) delete mode 100644 erpnext/communication/doctype/appointment/__init__.py delete mode 100644 erpnext/communication/doctype/appointment/appointment.js delete mode 100644 erpnext/communication/doctype/appointment/appointment.json delete mode 100644 erpnext/communication/doctype/appointment/appointment.py delete mode 100644 erpnext/communication/doctype/appointment/test_appointment.py diff --git a/erpnext/communication/doctype/appointment/__init__.py b/erpnext/communication/doctype/appointment/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/erpnext/communication/doctype/appointment/appointment.js b/erpnext/communication/doctype/appointment/appointment.js deleted file mode 100644 index 4e41047fa11..00000000000 --- a/erpnext/communication/doctype/appointment/appointment.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Appointment', { - // refresh: function(frm) { - - // } -}); diff --git a/erpnext/communication/doctype/appointment/appointment.json b/erpnext/communication/doctype/appointment/appointment.json deleted file mode 100644 index 7d808486abc..00000000000 --- a/erpnext/communication/doctype/appointment/appointment.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "autoname": "APMT.#####", - "creation": "2019-10-22 12:06:17.491113", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "start_time", - "appointment_duration", - "timezone", - "atendees_section", - "requester_type", - "requester", - "col_br_1", - "invitee_type", - "invitee" - ], - "fields": [ - { - "fieldname": "start_time", - "fieldtype": "Datetime", - "in_list_view": 1, - "label": "Start Time", - "reqd": 1 - }, - { - "fieldname": "appointment_duration", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Duration in minutes", - "reqd": 1 - }, - { - "fieldname": "requester", - "fieldtype": "Dynamic Link", - "in_list_view": 1, - "label": "Appointment Requester ", - "options": "requester_type", - "reqd": 1 - }, - { - "fieldname": "invitee", - "fieldtype": "Dynamic Link", - "in_list_view": 1, - "label": "Appointment Invitee", - "options": "invitee_type", - "reqd": 1 - }, - { - "fieldname": "timezone", - "fieldtype": "Data", - "label": "Requester's Timezone", - "reqd": 1 - }, - { - "fieldname": "atendees_section", - "fieldtype": "Section Break", - "label": "Atendees" - }, - { - "fieldname": "requester_type", - "fieldtype": "Link", - "label": "Requester Type", - "options": "DocType", - "reqd": 1 - }, - { - "fieldname": "col_br_1", - "fieldtype": "Column Break" - }, - { - "fieldname": "invitee_type", - "fieldtype": "Link", - "label": "Invitee Type", - "options": "DocType", - "reqd": 1 - } - ], - "modified": "2019-10-22 12:18:20.719128", - "modified_by": "Administrator", - "module": "Communication", - "name": "Appointment", - "name_case": "UPPER CASE", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/erpnext/communication/doctype/appointment/appointment.py b/erpnext/communication/doctype/appointment/appointment.py deleted file mode 100644 index 204b066031b..00000000000 --- a/erpnext/communication/doctype/appointment/appointment.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document - -class Appointment(Document): - pass diff --git a/erpnext/communication/doctype/appointment/test_appointment.py b/erpnext/communication/doctype/appointment/test_appointment.py deleted file mode 100644 index 702ac7176fb..00000000000 --- a/erpnext/communication/doctype/appointment/test_appointment.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors -# See license.txt -from __future__ import unicode_literals - -# import frappe -import unittest - -class TestAppointment(unittest.TestCase): - pass From be5c6e7aecfd82c0bb06096ba6d3d75068a9d980 Mon Sep 17 00:00:00 2001 From: 0Pranav Date: Wed, 30 Oct 2019 11:14:49 +0530 Subject: [PATCH 6/9] fix:readability --- .../doctype/maintenance_schedule/maintenance_schedule.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js index e91f478aa49..41c0ccad57b 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js +++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js @@ -21,10 +21,9 @@ frappe.ui.form.on('Maintenance Schedule', { } }, refresh: function(frm) { - setTimeout(()=> { - debugger; - frm.toggle_display('generate_schedule',!(frm.is_new())); - frm.toggle_display('schedule',!(frm.is_new())); + setTimeout(() => { + frm.toggle_display('generate_schedule', !(frm.is_new())); + frm.toggle_display('schedule', !(frm.is_new())); },10); }, customer: function(frm) { From da5bf5a7c41925d970f43849b19da1380ae4f27a Mon Sep 17 00:00:00 2001 From: 0Pranav Date: Wed, 30 Oct 2019 11:24:58 +0530 Subject: [PATCH 7/9] fix:indentation --- .../doctype/maintenance_schedule/maintenance_schedule.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js index 41c0ccad57b..ea48b4ef8b7 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js +++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js @@ -21,10 +21,10 @@ frappe.ui.form.on('Maintenance Schedule', { } }, refresh: function(frm) { - setTimeout(() => { - frm.toggle_display('generate_schedule', !(frm.is_new())); - frm.toggle_display('schedule', !(frm.is_new())); - },10); + setTimeout(() => { + frm.toggle_display('generate_schedule', !(frm.is_new())); + frm.toggle_display('schedule', !(frm.is_new())); + },10); }, customer: function(frm) { erpnext.utils.get_party_details(frm) From 07b74533fe47b671e051e512f0d83b85eb51300a Mon Sep 17 00:00:00 2001 From: 0Pranav Date: Wed, 30 Oct 2019 13:47:49 +0530 Subject: [PATCH 8/9] fix: error message matches field name --- .../doctype/maintenance_schedule/maintenance_schedule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py index 1ad7fc85523..94d85f77ef4 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py +++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py @@ -150,7 +150,7 @@ class MaintenanceSchedule(TransactionBase): elif not d.no_of_visits: throw(_("Please mention no of visits required")) elif not d.sales_person: - throw(_("Please select Incharge Person's name for item: {0}".format(d.item_name))) + throw(_("Please select a Sales Person for item: {0}".format(d.item_name))) if getdate(d.start_date) >= getdate(d.end_date): throw(_("Start date should be less than end date for Item {0}").format(d.item_code)) From c8333d4b41386a386d87aa8469dcf07b1cc2b768 Mon Sep 17 00:00:00 2001 From: 0Pranav Date: Wed, 30 Oct 2019 13:48:01 +0530 Subject: [PATCH 9/9] fix: codacy --- .../doctype/maintenance_schedule/maintenance_schedule.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js index ea48b4ef8b7..e940b6050c6 100644 --- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js +++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.js @@ -21,7 +21,7 @@ frappe.ui.form.on('Maintenance Schedule', { } }, refresh: function(frm) { - setTimeout(() => { + setTimeout(() => { frm.toggle_display('generate_schedule', !(frm.is_new())); frm.toggle_display('schedule', !(frm.is_new())); },10);