From a0f7656ffcbca4c264c3b41bf2266ade8b70bcd1 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Tue, 16 Apr 2019 10:19:53 +0530 Subject: [PATCH 01/39] feat: Add skill child table to designation doctype - To record skills required of a particular designation --- .../hr/doctype/designation/designation.json | 291 +++++++++++------- .../hr/doctype/designation_skill/__init__.py | 0 .../designation_skill/designation_skill.json | 74 +++++ .../designation_skill/designation_skill.py | 10 + erpnext/hr/doctype/skill/__init__.py | 0 erpnext/hr/doctype/skill/skill.js | 8 + erpnext/hr/doctype/skill/skill.json | 113 +++++++ erpnext/hr/doctype/skill/skill.py | 10 + 8 files changed, 398 insertions(+), 108 deletions(-) create mode 100644 erpnext/hr/doctype/designation_skill/__init__.py create mode 100644 erpnext/hr/doctype/designation_skill/designation_skill.json create mode 100644 erpnext/hr/doctype/designation_skill/designation_skill.py create mode 100644 erpnext/hr/doctype/skill/__init__.py create mode 100644 erpnext/hr/doctype/skill/skill.js create mode 100644 erpnext/hr/doctype/skill/skill.json create mode 100644 erpnext/hr/doctype/skill/skill.py diff --git a/erpnext/hr/doctype/designation/designation.json b/erpnext/hr/doctype/designation/designation.json index 1d4a3cf7b7..4c3888be4a 100644 --- a/erpnext/hr/doctype/designation/designation.json +++ b/erpnext/hr/doctype/designation/designation.json @@ -1,119 +1,194 @@ { - "allow_copy": 0, - "allow_import": 1, - "allow_rename": 1, - "autoname": "field:designation_name", - "beta": 0, - "creation": "2013-01-10 16:34:13", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "Setup", - "editable_grid": 0, + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:designation_name", + "beta": 0, + "creation": "2013-01-10 16:34:13", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 0, "fields": [ { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "designation_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Designation", - "length": 0, - "no_copy": 0, - "oldfieldname": "designation_name", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "designation_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Designation", + "length": 0, + "no_copy": 0, + "oldfieldname": "designation_name", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 1 + }, { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "description", - "fieldtype": "Text", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Description", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "description", + "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "required_skills_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Required Skills", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "skills", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Skills", + "length": 0, + "no_copy": 0, + "options": "Designation Skill", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "icon": "fa fa-bookmark", - "idx": 1, - "image_view": 0, - "in_create": 0, - - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2017-02-17 16:53:43.895882", - "modified_by": "Administrator", - "module": "HR", - "name": "Designation", - "owner": "Administrator", + ], + "has_web_view": 0, + "hide_toolbar": 0, + "icon": "fa fa-bookmark", + "idx": 1, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "menu_index": 0, + "modified": "2019-04-16 10:02:23.277734", + "modified_by": "Administrator", + "module": "HR", + "name": "Designation", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "HR User", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "HR User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, "write": 1 } - ], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 1, - "sort_order": "ASC", - "track_changes": 0, - "track_seen": 0 + ], + "quick_entry": 1, + "read_only": 0, + "show_name_in_global_search": 1, + "sort_order": "ASC", + "track_changes": 0, + "track_seen": 0, + "track_views": 0 } \ No newline at end of file diff --git a/erpnext/hr/doctype/designation_skill/__init__.py b/erpnext/hr/doctype/designation_skill/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/hr/doctype/designation_skill/designation_skill.json b/erpnext/hr/doctype/designation_skill/designation_skill.json new file mode 100644 index 0000000000..11ae745cd6 --- /dev/null +++ b/erpnext/hr/doctype/designation_skill/designation_skill.json @@ -0,0 +1,74 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-04-16 10:01:05.259881", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "skill", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Skill", + "length": 0, + "no_copy": 0, + "options": "Skill", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-04-16 10:01:05.259881", + "modified_by": "Administrator", + "module": "HR", + "name": "Designation Skill", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "ASC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/erpnext/hr/doctype/designation_skill/designation_skill.py b/erpnext/hr/doctype/designation_skill/designation_skill.py new file mode 100644 index 0000000000..c37d21f454 --- /dev/null +++ b/erpnext/hr/doctype/designation_skill/designation_skill.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 DesignationSkill(Document): + pass diff --git a/erpnext/hr/doctype/skill/__init__.py b/erpnext/hr/doctype/skill/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/hr/doctype/skill/skill.js b/erpnext/hr/doctype/skill/skill.js new file mode 100644 index 0000000000..a939ff0dab --- /dev/null +++ b/erpnext/hr/doctype/skill/skill.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('Skill', { + // refresh: function(frm) { + + // } +}); diff --git a/erpnext/hr/doctype/skill/skill.json b/erpnext/hr/doctype/skill/skill.json new file mode 100644 index 0000000000..518297395b --- /dev/null +++ b/erpnext/hr/doctype/skill/skill.json @@ -0,0 +1,113 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:skill_name", + "beta": 0, + "creation": "2019-04-16 09:54:39.486915", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 0, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "skill_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Skill Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 1 + } + ], + "has_web_view": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-04-16 09:55:00.536328", + "modified_by": "Administrator", + "module": "HR", + "name": "Skill", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "HR Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "ASC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/erpnext/hr/doctype/skill/skill.py b/erpnext/hr/doctype/skill/skill.py new file mode 100644 index 0000000000..8d24212075 --- /dev/null +++ b/erpnext/hr/doctype/skill/skill.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 Skill(Document): + pass From 354c70a0e72cd9838ce8e73bc2d73ab55dadff5f Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Tue, 16 Apr 2019 10:20:32 +0530 Subject: [PATCH 02/39] feat: Init employee skill map doctype --- erpnext/hr/doctype/employee_skill/__init__.py | 0 .../employee_skill/employee_skill.json | 173 +++++++++++++ .../doctype/employee_skill/employee_skill.py | 10 + .../hr/doctype/employee_skill_map/__init__.py | 0 .../employee_skill_map/employee_skill_map.js | 8 + .../employee_skill_map.json | 231 ++++++++++++++++++ .../employee_skill_map/employee_skill_map.py | 10 + 7 files changed, 432 insertions(+) create mode 100644 erpnext/hr/doctype/employee_skill/__init__.py create mode 100644 erpnext/hr/doctype/employee_skill/employee_skill.json create mode 100644 erpnext/hr/doctype/employee_skill/employee_skill.py create mode 100644 erpnext/hr/doctype/employee_skill_map/__init__.py create mode 100644 erpnext/hr/doctype/employee_skill_map/employee_skill_map.js create mode 100644 erpnext/hr/doctype/employee_skill_map/employee_skill_map.json create mode 100644 erpnext/hr/doctype/employee_skill_map/employee_skill_map.py diff --git a/erpnext/hr/doctype/employee_skill/__init__.py b/erpnext/hr/doctype/employee_skill/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/hr/doctype/employee_skill/employee_skill.json b/erpnext/hr/doctype/employee_skill/employee_skill.json new file mode 100644 index 0000000000..84a76ea2e0 --- /dev/null +++ b/erpnext/hr/doctype/employee_skill/employee_skill.json @@ -0,0 +1,173 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-04-16 09:57:52.751635", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "skill", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Skill", + "length": 0, + "no_copy": 0, + "options": "Skill", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "proficiency", + "fieldtype": "Rating", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Proficiency", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "evaluation_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Evaluation Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "training_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Training Date", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-04-16 10:12:40.106070", + "modified_by": "Administrator", + "module": "HR", + "name": "Employee Skill", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "ASC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/erpnext/hr/doctype/employee_skill/employee_skill.py b/erpnext/hr/doctype/employee_skill/employee_skill.py new file mode 100644 index 0000000000..ac05fba624 --- /dev/null +++ b/erpnext/hr/doctype/employee_skill/employee_skill.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 EmployeeSkill(Document): + pass diff --git a/erpnext/hr/doctype/employee_skill_map/__init__.py b/erpnext/hr/doctype/employee_skill_map/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.js b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.js new file mode 100644 index 0000000000..071722bbbc --- /dev/null +++ b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.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('Employee Skill Map', { + // refresh: function(frm) { + + // } +}); diff --git a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json new file mode 100644 index 0000000000..6f3672ebd4 --- /dev/null +++ b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json @@ -0,0 +1,231 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "field:employee", + "beta": 0, + "creation": "2019-04-16 10:07:48.303426", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 0, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "employee", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Employee", + "length": 0, + "no_copy": 0, + "options": "Employee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 1 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_from": "employee.employee_name", + "fetch_if_empty": 0, + "fieldname": "employee_name", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Employee Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_from": "employee.designation", + "fetch_if_empty": 0, + "fieldname": "designation", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Designation", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "skills_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Skills", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "employee_skill", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Employee Skill", + "length": 0, + "no_copy": 0, + "options": "Employee Skill", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-04-16 10:15:18.634977", + "modified_by": "Administrator", + "module": "HR", + "name": "Employee Skill Map", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "ASC", + "title_field": "employee_name", + "track_changes": 0, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.py b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.py new file mode 100644 index 0000000000..073f02fa25 --- /dev/null +++ b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.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 EmployeeSkillMap(Document): + pass From 006c3dccf9616ce5bf521bdb3094b9a005dcf385 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Tue, 16 Apr 2019 12:14:44 +0530 Subject: [PATCH 03/39] feat: Add logic to auto fetch skill from designation doc - Set today as default evaluation date --- .../hr/doctype/employee_skill/employee_skill.json | 3 ++- .../employee_skill_map/employee_skill_map.js | 13 +++++++++++++ .../employee_skill_map/employee_skill_map.json | 6 +++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/erpnext/hr/doctype/employee_skill/employee_skill.json b/erpnext/hr/doctype/employee_skill/employee_skill.json index 84a76ea2e0..5fd0e4c2a5 100644 --- a/erpnext/hr/doctype/employee_skill/employee_skill.json +++ b/erpnext/hr/doctype/employee_skill/employee_skill.json @@ -87,6 +87,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "default": "Today", "fetch_if_empty": 0, "fieldname": "evaluation_date", "fieldtype": "Date", @@ -155,7 +156,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2019-04-16 10:12:40.106070", + "modified": "2019-04-16 11:33:05.055948", "modified_by": "Administrator", "module": "HR", "name": "Employee Skill", diff --git a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.js b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.js index 071722bbbc..b82b18d43b 100644 --- a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.js +++ b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.js @@ -5,4 +5,17 @@ frappe.ui.form.on('Employee Skill Map', { // refresh: function(frm) { // } + designation: (frm) => { + frm.set_value('employee_skills', null); + if (frm.doc.designation) { + frappe.db.get_doc('Designation', frm.doc.designation).then((designation) => { + designation.skills.forEach(designation_skill => { + let row = frappe.model.add_child(frm.doc, 'Employee Skill', 'employee_skills'); + row.skill = designation_skill.skill; + row.proficiency = 1; + }); + refresh_field('employee_skills'); + }); + } + } }); diff --git a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json index 6f3672ebd4..a54c3ae005 100644 --- a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json +++ b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json @@ -157,7 +157,7 @@ "collapsible": 0, "columns": 0, "fetch_if_empty": 0, - "fieldname": "employee_skill", + "fieldname": "employee_skills", "fieldtype": "Table", "hidden": 0, "ignore_user_permissions": 0, @@ -166,7 +166,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Employee Skill", + "label": "Employee Skills", "length": 0, "no_copy": 0, "options": "Employee Skill", @@ -192,7 +192,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-04-16 10:15:18.634977", + "modified": "2019-04-16 11:19:49.189166", "modified_by": "Administrator", "module": "HR", "name": "Employee Skill Map", From 3aa5e125bdfcd81225ea77e47436b5af42e865bc Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Thu, 18 Apr 2019 12:46:33 +0530 Subject: [PATCH 04/39] feat: Add employee training section to the employee skill map --- .../designation_skill/designation_skill.json | 2 +- .../employee_skill/employee_skill.json | 35 +-------- .../employee_skill_map.json | 69 ++++++++++++++++- .../hr/doctype/employee_training/__init__.py | 0 .../employee_training/employee_training.json | 74 +++++++++++++++++++ .../employee_training/employee_training.py | 10 +++ 6 files changed, 154 insertions(+), 36 deletions(-) create mode 100644 erpnext/hr/doctype/employee_training/__init__.py create mode 100644 erpnext/hr/doctype/employee_training/employee_training.json create mode 100644 erpnext/hr/doctype/employee_training/employee_training.py diff --git a/erpnext/hr/doctype/designation_skill/designation_skill.json b/erpnext/hr/doctype/designation_skill/designation_skill.json index 11ae745cd6..30e23d0f02 100644 --- a/erpnext/hr/doctype/designation_skill/designation_skill.json +++ b/erpnext/hr/doctype/designation_skill/designation_skill.json @@ -56,7 +56,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2019-04-16 10:01:05.259881", + "modified": "2019-04-16 13:42:10.760449", "modified_by": "Administrator", "module": "HR", "name": "Designation Skill", diff --git a/erpnext/hr/doctype/employee_skill/employee_skill.json b/erpnext/hr/doctype/employee_skill/employee_skill.json index 5fd0e4c2a5..4b1419e1ec 100644 --- a/erpnext/hr/doctype/employee_skill/employee_skill.json +++ b/erpnext/hr/doctype/employee_skill/employee_skill.json @@ -113,39 +113,6 @@ "set_only_once": 0, "translatable": 0, "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fetch_if_empty": 0, - "fieldname": "training_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Training Date", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 } ], "has_web_view": 0, @@ -156,7 +123,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2019-04-16 11:33:05.055948", + "modified": "2019-04-16 14:13:17.111035", "modified_by": "Administrator", "module": "HR", "name": "Employee Skill", diff --git a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json index a54c3ae005..624145f23a 100644 --- a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json +++ b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.json @@ -182,6 +182,73 @@ "set_only_once": 0, "translatable": 0, "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "trainings_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Trainings", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "trainings", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Trainings", + "length": 0, + "no_copy": 0, + "options": "Employee Training", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 } ], "has_web_view": 0, @@ -192,7 +259,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2019-04-16 11:19:49.189166", + "modified": "2019-04-16 16:16:40.058429", "modified_by": "Administrator", "module": "HR", "name": "Employee Skill Map", diff --git a/erpnext/hr/doctype/employee_training/__init__.py b/erpnext/hr/doctype/employee_training/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/hr/doctype/employee_training/employee_training.json b/erpnext/hr/doctype/employee_training/employee_training.json new file mode 100644 index 0000000000..f9d5f4a0f8 --- /dev/null +++ b/erpnext/hr/doctype/employee_training/employee_training.json @@ -0,0 +1,74 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2019-04-16 16:15:50.931545", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "training", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Training", + "length": 0, + "no_copy": 0, + "options": "Training Event", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2019-04-16 16:17:08.084637", + "modified_by": "Administrator", + "module": "HR", + "name": "Employee Training", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "ASC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/erpnext/hr/doctype/employee_training/employee_training.py b/erpnext/hr/doctype/employee_training/employee_training.py new file mode 100644 index 0000000000..810796d66c --- /dev/null +++ b/erpnext/hr/doctype/employee_training/employee_training.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 EmployeeTraining(Document): + pass From 36bb3f55f2a90c6748775d78c0a0e1dd0ff6ea9d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Apr 2019 14:47:44 +0530 Subject: [PATCH 05/39] fix: Added invoice discounting dashboard --- .../invoice_discounting_dashboard.py | 20 +++++++++++++++++++ erpnext/config/accounting.py | 5 +++++ 2 files changed, 25 insertions(+) create mode 100644 erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py new file mode 100644 index 0000000000..6523cd3cdb --- /dev/null +++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py @@ -0,0 +1,20 @@ +from __future__ import unicode_literals +from frappe import _ + +def get_data(): + return { + 'fieldname': 'reference_name', + 'internal_links': { + 'Sales Invoice': ['invoices', 'sales_invoice'] + }, + 'transactions': [ + { + 'label': _('Reference'), + 'items': ['Sales Invoice'] + }, + { + 'label': _('Payment'), + 'items': ['Payment Entry', 'Journal Entry'] + } + ] + } \ No newline at end of file diff --git a/erpnext/config/accounting.py b/erpnext/config/accounting.py index afe35f8078..1b8bf2717b 100644 --- a/erpnext/config/accounting.py +++ b/erpnext/config/accounting.py @@ -232,6 +232,11 @@ def get_data(): "label": _("Bank Account"), "name": "Bank Account", }, + { + "type": "doctype", + "label": _("Invoice Discounting"), + "name": "Invoice Discounting", + }, { "type": "doctype", "label": _("Bank Statement Transaction Entry List"), From 8170585faf3204b815d2a7770892509aaaac6052 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Apr 2019 15:13:18 +0530 Subject: [PATCH 06/39] fix: Don't fetch already discounted invoice --- .../doctype/invoice_discounting/invoice_discounting.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py index 64aa4e4af6..d1ede67ed4 100644 --- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py +++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py @@ -190,9 +190,11 @@ def get_invoices(filters): customer, posting_date, outstanding_amount - from `tabSales Invoice` + from `tabSales Invoice` si where docstatus = 1 and outstanding_amount > 0 %s + and not exists(select di.name from `tabDiscounted Invoice` di + where di.docstatus=1 and di.sales_invoice=si.name) """ % where_condition, filters, as_dict=1) \ No newline at end of file From c99c712913add6c8fb1864c2e63cfbe3792855bd Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 18 Apr 2019 15:52:50 +0530 Subject: [PATCH 07/39] fix: Validate and update invoice discounting status on JE submit/cancel --- .../doctype/journal_entry/journal_entry.py | 57 ++++++++++++------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 28869d86d9..08d707385c 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import frappe, erpnext, json -from frappe.utils import cstr, flt, fmt_money, formatdate, getdate, nowdate, cint +from frappe.utils import cstr, flt, fmt_money, formatdate, getdate, nowdate, cint, get_link_to_form from frappe import msgprint, _, scrub from erpnext.controllers.accounts_controller import AccountsController from erpnext.accounts.utils import get_balance_on, get_account_currency @@ -53,6 +53,20 @@ class JournalEntry(AccountsController): self.update_inter_company_jv() self.update_invoice_discounting() + def on_cancel(self): + from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries + from erpnext.hr.doctype.salary_slip.salary_slip import unlink_ref_doc_from_salary_slip + unlink_ref_doc_from_payment_entries(self) + unlink_ref_doc_from_salary_slip(self.name) + self.make_gl_entries(1) + self.update_advance_paid() + self.update_expense_claim() + self.update_loan() + self.unlink_advance_entry_reference() + self.unlink_asset_reference() + self.unlink_inter_company_jv() + self.unlink_asset_adjustment_entry() + self.update_invoice_discounting() def get_title(self): return self.pay_to_recd_from or self.accounts[0].account @@ -83,31 +97,32 @@ class JournalEntry(AccountsController): "inter_company_journal_entry_reference", self.name) def update_invoice_discounting(self): - invoice_discounting_list = [d.reference_name for d in self.accounts if d.reference_type=="Invoice Discounting"] + def _validate_invoice_discounting_status(inv_disc, id_status, expected_status, row_id): + id_link = get_link_to_form("Invoice Discounting", inv_disc) + if id_status != expected_status: + frappe.throw(_("Row #{0}: Status must be {1} for Invoice Discounting {2}").format(d.idx, expected_status, id_link)) + + invoice_discounting_list = list(set([d.reference_name for d in self.accounts if d.reference_type=="Invoice Discounting"])) for inv_disc in invoice_discounting_list: - short_term_loan_account = frappe.db.get_value("Invoice Discounting", inv_disc, "short_term_loan") + short_term_loan_account, id_status = frappe.db.get_value("Invoice Discounting", inv_disc, ["short_term_loan", "status"]) for d in self.accounts: if d.account == short_term_loan_account and d.reference_name == inv_disc: - if d.credit > 0: - status = "Disbursed" - elif d.debit > 0: - status = "Settled" + if self.docstatus == 1: + if d.credit > 0: + _validate_invoice_discounting_status(inv_disc, id_status, "Sanctioned", d.idx) + status = "Disbursed" + elif d.debit > 0: + _validate_invoice_discounting_status(inv_disc, id_status, "Disbursed", d.idx) + status = "Settled" + else: + if d.credit > 0: + _validate_invoice_discounting_status(inv_disc, id_status, "Disbursed", d.idx) + status = "Sanctioned" + elif d.debit > 0: + _validate_invoice_discounting_status(inv_disc, id_status, "Settled", d.idx) + status = "Disbursed" frappe.db.set_value("Invoice Discounting", inv_disc, "status", status) - def on_cancel(self): - from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries - from erpnext.hr.doctype.salary_slip.salary_slip import unlink_ref_doc_from_salary_slip - unlink_ref_doc_from_payment_entries(self) - unlink_ref_doc_from_salary_slip(self.name) - self.make_gl_entries(1) - self.update_advance_paid() - self.update_expense_claim() - self.update_loan() - self.unlink_advance_entry_reference() - self.unlink_asset_reference() - self.unlink_inter_company_jv() - self.unlink_asset_adjustment_entry() - def unlink_advance_entry_reference(self): for d in self.get("accounts"): if d.is_advance == "Yes" and d.reference_type in ("Sales Invoice", "Purchase Invoice"): From e1a6022c8c3e45281db49621f449b1d7e839d26e Mon Sep 17 00:00:00 2001 From: Prasad R Date: Fri, 19 Apr 2019 10:57:21 +0530 Subject: [PATCH 08/39] fix: Allow system manager to access share ledger --- erpnext/accounts/report/share_ledger/share_ledger.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/share_ledger/share_ledger.json b/erpnext/accounts/report/share_ledger/share_ledger.json index d374bb7747..fe158a6f00 100644 --- a/erpnext/accounts/report/share_ledger/share_ledger.json +++ b/erpnext/accounts/report/share_ledger/share_ledger.json @@ -1,23 +1,27 @@ { "add_total_row": 0, - "apply_user_permissions": 1, "creation": "2017-12-27 16:15:52.615453", + "disable_prepared_report": 0, "disabled": 0, "docstatus": 0, "doctype": "Report", "idx": 0, "is_standard": "Yes", - "modified": "2017-12-27 16:46:54.422356", + "modified": "2019-04-19 10:50:36.061588", "modified_by": "Administrator", "module": "Accounts", "name": "Share Ledger", "owner": "Administrator", + "prepared_report": 0, "ref_doctype": "Share Transfer", "report_name": "Share Ledger", "report_type": "Script Report", "roles": [ { "role": "Administrator" + }, + { + "role": "System Manager" } ] } \ No newline at end of file From 198c7ae73d34d3ec9a337e36c413b8dcb62c3e6a Mon Sep 17 00:00:00 2001 From: Prasad R Date: Fri, 19 Apr 2019 12:17:19 +0530 Subject: [PATCH 09/39] fix: show 2 missing doctypes in Accounts --- erpnext/config/accounting.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/erpnext/config/accounting.py b/erpnext/config/accounting.py index afe35f8078..4a04f267bc 100644 --- a/erpnext/config/accounting.py +++ b/erpnext/config/accounting.py @@ -78,6 +78,11 @@ def get_data(): "name": "Payment Entry", "description": _("Bank/Cash transactions against party or for internal transfer") }, + { + "type": "doctype", + "name": "Payment Term", + "description": _("Payment Terms based on conditions") + } # Reports { @@ -131,6 +136,11 @@ def get_data(): "name": "Currency Exchange", "description": _("Currency exchange rate master.") }, + { + "type": "doctype", + "name": "Exchange Rate Revaluation", + "description": _("Exchange Rate Revaluation master.") + }, { "type": "doctype", "name": "Payment Gateway Account", From 1d78aae2af15e9bd7039784e9a73d047ea234615 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Fri, 19 Apr 2019 14:03:25 +0530 Subject: [PATCH 10/39] fix: Add index to Item route Increases route resolve time if there are lots of Items. --- erpnext/stock/doctype/item/item.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index aa51f4793d..aeab9ed978 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -1062,3 +1062,7 @@ def update_variants(variants, template, publish_progress=True): count+=1 if publish_progress: frappe.publish_progress(count*100/len(variants), title = _("Updating Variants...")) + +def on_doctype_update(): + # since route is a Text column, it needs a length for indexing + frappe.db.add_index("Item", ["route(500)"]) From 72cc7508b0e4fddd16cb1d59b32e2e4b308c3d09 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 18 Apr 2019 19:03:30 +0530 Subject: [PATCH 11/39] fix: Requested Items To Be Ordered report showing records even if material request is fully ordered --- .../requested_items_to_be_ordered.json | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/erpnext/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.json b/erpnext/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.json index f351f3b573..9e6e80a342 100644 --- a/erpnext/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.json +++ b/erpnext/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.json @@ -1,28 +1,29 @@ { - "add_total_row": 1, - "apply_user_permissions": 1, - "creation": "2013-05-13 16:10:02", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "idx": 3, - "is_standard": "Yes", - "modified": "2017-02-24 20:10:53.005589", - "modified_by": "Administrator", - "module": "Buying", - "name": "Requested Items To Be Ordered", - "owner": "Administrator", - "query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tsum(ifnull(mr_item.qty, 0)) as \"Qty:Float:100\",\n\tsum(ifnull(mr_item.ordered_qty, 0)) as \"Ordered Qty:Float:100\", \n\t(sum(mr_item.qty) - sum(ifnull(mr_item.ordered_qty, 0))) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\",\n\tmr.company as \"Company:Link/Company:\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\ngroup by mr.name, mr_item.item_code\nhaving\n\tsum(ifnull(mr_item.ordered_qty, 0)) < sum(ifnull(mr_item.qty, 0))\norder by mr.transaction_date asc", - "ref_doctype": "Purchase Order", - "report_name": "Requested Items To Be Ordered", - "report_type": "Query Report", + "add_total_row": 1, + "creation": "2013-05-13 16:10:02", + "disable_prepared_report": 0, + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 3, + "is_standard": "Yes", + "modified": "2019-04-18 19:02:03.099422", + "modified_by": "Administrator", + "module": "Buying", + "name": "Requested Items To Be Ordered", + "owner": "Administrator", + "prepared_report": 0, + "query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tsum(ifnull(mr_item.stock_qty, 0)) as \"Qty:Float:100\",\n\tifnull(mr_item.stock_uom, '') as \"UOM:Link/UOM:100\",\n\tsum(ifnull(mr_item.ordered_qty, 0)) as \"Ordered Qty:Float:100\", \n\t(sum(mr_item.stock_qty) - sum(ifnull(mr_item.ordered_qty, 0))) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\",\n\tmr.company as \"Company:Link/Company:\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\ngroup by mr.name, mr_item.item_code\nhaving\n\tsum(ifnull(mr_item.ordered_qty, 0)) < sum(ifnull(mr_item.stock_qty, 0))\norder by mr.transaction_date asc", + "ref_doctype": "Purchase Order", + "report_name": "Requested Items To Be Ordered", + "report_type": "Query Report", "roles": [ { "role": "Stock User" - }, + }, { "role": "Purchase Manager" - }, + }, { "role": "Purchase User" } From 8da71cebb7afec442cc44e0cc45e2675b004147e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 19 Apr 2019 15:10:02 +0530 Subject: [PATCH 12/39] fix: test cases --- .../test_invoice_discounting.py | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py index 4f93e11def..dc7f462952 100644 --- a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py +++ b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py @@ -122,23 +122,26 @@ class TestInvoiceDiscounting(unittest.TestCase): period=60 ) - inv_disc.create_disbursement_entry() - je = inv_disc.close_loan() + je1 = inv_disc.create_disbursement_entry() + je1.posting_date = nowdate() + je1.submit() - self.assertEqual(je.accounts[0].account, self.short_term_loan) - self.assertEqual(je.accounts[0].debit_in_account_currency, flt(inv_disc.total_amount)) + je2 = inv_disc.close_loan() - self.assertEqual(je.accounts[1].account, self.bank_account) - self.assertEqual(je.accounts[1].credit_in_account_currency, flt(inv_disc.total_amount)) + self.assertEqual(je2.accounts[0].account, self.short_term_loan) + self.assertEqual(je2.accounts[0].debit_in_account_currency, flt(inv_disc.total_amount)) - self.assertEqual(je.accounts[2].account, self.ar_discounted) - self.assertEqual(je.accounts[2].credit_in_account_currency, flt(inv.outstanding_amount)) + self.assertEqual(je2.accounts[1].account, self.bank_account) + self.assertEqual(je2.accounts[1].credit_in_account_currency, flt(inv_disc.total_amount)) - self.assertEqual(je.accounts[3].account, self.ar_unpaid) - self.assertEqual(je.accounts[3].debit_in_account_currency, flt(inv.outstanding_amount)) + self.assertEqual(je2.accounts[2].account, self.ar_discounted) + self.assertEqual(je2.accounts[2].credit_in_account_currency, flt(inv.outstanding_amount)) - je.posting_date = nowdate() - je.submit() + self.assertEqual(je2.accounts[3].account, self.ar_unpaid) + self.assertEqual(je2.accounts[3].debit_in_account_currency, flt(inv.outstanding_amount)) + + je2.posting_date = nowdate() + je2.submit() inv_disc.reload() self.assertEqual(inv_disc.status, "Settled") @@ -154,19 +157,21 @@ class TestInvoiceDiscounting(unittest.TestCase): bank_account=self.bank_account, start=add_days(nowdate(), -80), period=60 - ) + ) - inv_disc.create_disbursement_entry() - je = inv_disc.close_loan() + je1 = inv_disc.create_disbursement_entry() + je1.posting_date = nowdate() + je1.submit() - je.posting_date = nowdate() - je.submit() + je2 = inv_disc.close_loan() + je2.posting_date = nowdate() + je2.submit() - self.assertEqual(je.accounts[0].account, self.short_term_loan) - self.assertEqual(je.accounts[0].debit_in_account_currency, flt(inv_disc.total_amount)) + self.assertEqual(je2.accounts[0].account, self.short_term_loan) + self.assertEqual(je2.accounts[0].debit_in_account_currency, flt(inv_disc.total_amount)) - self.assertEqual(je.accounts[1].account, self.bank_account) - self.assertEqual(je.accounts[1].credit_in_account_currency, flt(inv_disc.total_amount)) + self.assertEqual(je2.accounts[1].account, self.bank_account) + self.assertEqual(je2.accounts[1].credit_in_account_currency, flt(inv_disc.total_amount)) inv_disc.reload() From d2797be1cd8dc4928f844161092e0644968a651d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 19 Apr 2019 15:33:05 +0530 Subject: [PATCH 13/39] fix: Close loan considering latest inv outstanding balance --- .../invoice_discounting.py | 34 +++++++++--------- .../test_invoice_discounting.py | 36 ++++++++++++++++--- 2 files changed, 50 insertions(+), 20 deletions(-) diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py index 64aa4e4af6..ba33c7822e 100644 --- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py +++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py @@ -145,23 +145,25 @@ class InvoiceDiscounting(AccountsController): if getdate(self.loan_end_date) > getdate(nowdate()): for d in self.invoices: - je.append("accounts", { - "account": self.accounts_receivable_discounted, - "credit_in_account_currency": flt(d.outstanding_amount), - "reference_type": "Invoice Discounting", - "reference_name": self.name, - "party_type": "Customer", - "party": d.customer - }) + outstanding_amount = frappe.db.get_value("Sales Invoice", d.sales_invoice, "outstanding_amount") + if flt(outstanding_amount) > 0: + je.append("accounts", { + "account": self.accounts_receivable_discounted, + "credit_in_account_currency": flt(outstanding_amount), + "reference_type": "Invoice Discounting", + "reference_name": self.name, + "party_type": "Customer", + "party": d.customer + }) - je.append("accounts", { - "account": self.accounts_receivable_unpaid, - "debit_in_account_currency": flt(d.outstanding_amount), - "reference_type": "Invoice Discounting", - "reference_name": self.name, - "party_type": "Customer", - "party": d.customer - }) + je.append("accounts", { + "account": self.accounts_receivable_unpaid, + "debit_in_account_currency": flt(outstanding_amount), + "reference_type": "Invoice Discounting", + "reference_name": self.name, + "party_type": "Customer", + "party": d.customer + }) return je diff --git a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py index 4f93e11def..a11412cb83 100644 --- a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py +++ b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py @@ -143,6 +143,38 @@ class TestInvoiceDiscounting(unittest.TestCase): self.assertEqual(inv_disc.status, "Settled") + def test_on_close_after_loan_period_after_inv_payment(self): + inv = create_sales_invoice(rate=600) + inv_disc = create_invoice_discounting([inv.name], + accounts_receivable_credit=self.ar_credit, + accounts_receivable_discounted=self.ar_discounted, + accounts_receivable_unpaid=self.ar_unpaid, + short_term_loan=self.short_term_loan, + bank_charges_account=self.bank_charges_account, + bank_account=self.bank_account, + start=nowdate(), + period=60 + ) + + je1 = inv_disc.create_disbursement_entry() + je1.posting_date = nowdate() + je1.submit() + + je_on_payment = frappe.get_doc(get_payment_entry_against_invoice("Sales Invoice", inv.name)) + je_on_payment.posting_date = nowdate() + je_on_payment.cheque_no = "126981" + je_on_payment.cheque_date = nowdate() + je_on_payment.save() + je_on_payment.submit() + + je2 = inv_disc.close_loan() + + self.assertEqual(je2.accounts[0].account, self.short_term_loan) + self.assertEqual(je2.accounts[0].debit_in_account_currency, flt(inv_disc.total_amount)) + + self.assertEqual(je2.accounts[1].account, self.bank_account) + self.assertEqual(je2.accounts[1].credit_in_account_currency, flt(inv_disc.total_amount)) + def test_on_close_before_loan_period(self): inv = create_sales_invoice(rate=700) inv_disc = create_invoice_discounting([inv.name], @@ -168,10 +200,6 @@ class TestInvoiceDiscounting(unittest.TestCase): self.assertEqual(je.accounts[1].account, self.bank_account) self.assertEqual(je.accounts[1].credit_in_account_currency, flt(inv_disc.total_amount)) - inv_disc.reload() - - self.assertEqual(inv_disc.status, "Settled") - def test_make_payment_before_loan_period(self): #it has problem inv = create_sales_invoice(rate=700) From 4a5bed5c07123f3cd04f642e011a85bc4697b116 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 19 Apr 2019 19:59:07 +0530 Subject: [PATCH 14/39] fix: fetch party account as discounted receivable account in payment entry --- .../invoice_discounting.py | 19 ++++++++++++++++++- .../doctype/journal_entry/journal_entry.py | 18 +----------------- .../doctype/payment_entry/payment_entry.py | 5 +++-- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py index 590929bade..c8756af7d7 100644 --- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py +++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py @@ -199,4 +199,21 @@ def get_invoices(filters): %s and not exists(select di.name from `tabDiscounted Invoice` di where di.docstatus=1 and di.sales_invoice=si.name) - """ % where_condition, filters, as_dict=1) \ No newline at end of file + """ % where_condition, filters, as_dict=1) + +def get_party_account_based_on_invoice_discounting(sales_invoice): + party_account = None + invoice_discounting = frappe.db.sql(""" + select par.accounts_receivable_discounted, par.accounts_receivable_unpaid, par.status + from `tabInvoice Discounting` par, `tabDiscounted Invoice` ch + where par.name=ch.parent + and par.docstatus=1 + and ch.sales_invoice = %s + """, (sales_invoice), as_dict=1) + if invoice_discounting: + if invoice_discounting[0].status == "Disbursed": + party_account = invoice_discounting[0].accounts_receivable_discounted + elif invoice_discounting[0].status == "Settled": + party_account = invoice_discounting[0].accounts_receivable_unpaid + + return party_account diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 08d707385c..63f180dcce 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -10,6 +10,7 @@ from erpnext.accounts.utils import get_balance_on, get_account_currency from erpnext.accounts.party import get_party_account from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount from erpnext.hr.doctype.loan.loan import update_disbursement_status, update_total_amount_paid +from erpnext.accounts.doctype.invoice_discounting.invoice_discounting import get_party_account_based_on_invoice_discounting from six import string_types, iteritems @@ -747,23 +748,6 @@ def get_payment_entry_against_invoice(dt, dn, amount=None, debit_in_account_cur "journal_entry": journal_entry }) -def get_party_account_based_on_invoice_discounting(sales_invoice): - party_account = None - invoice_discounting = frappe.db.sql(""" - select par.accounts_receivable_discounted, par.accounts_receivable_unpaid, par.status - from `tabInvoice Discounting` par, `tabDiscounted Invoice` ch - where par.name=ch.parent - and par.docstatus=1 - and ch.sales_invoice = %s - """, (sales_invoice), as_dict=1) - if invoice_discounting: - if invoice_discounting[0].status == "Disbursed": - party_account = invoice_discounting[0].accounts_receivable_discounted - elif invoice_discounting[0].status == "Settled": - party_account = invoice_discounting[0].accounts_receivable_unpaid - - return party_account - def get_payment_entry(ref_doc, args): cost_center = ref_doc.get("cost_center") or frappe.get_cached_value('Company', ref_doc.company, "cost_center") exchange_rate = 1 diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index eb672e023b..ec35f030d3 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -14,6 +14,7 @@ from erpnext.accounts.general_ledger import make_gl_entries from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount from erpnext.accounts.doctype.bank_account.bank_account import get_party_bank_account, get_bank_account_details from erpnext.controllers.accounts_controller import AccountsController, get_supplier_block_status +from erpnext.accounts.doctype.invoice_discounting.invoice_discounting import get_party_account_based_on_invoice_discounting from six import string_types, iteritems @@ -237,7 +238,7 @@ class PaymentEntry(AccountsController): if d.reference_doctype in ("Sales Invoice", "Purchase Invoice", "Expense Claim", "Fees"): if self.party_type == "Customer": - ref_party_account = ref_doc.debit_to + ref_party_account = get_party_account_based_on_invoice_discounting(d.reference_name) or ref_doc.debit_to elif self.party_type == "Student": ref_party_account = ref_doc.receivable_account elif self.party_type=="Supplier": @@ -826,7 +827,7 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount= # party account if dt == "Sales Invoice": - party_account = doc.debit_to + party_account = get_party_account_based_on_invoice_discounting(dn) or ref_doc.debit_to elif dt == "Purchase Invoice": party_account = doc.credit_to elif dt == "Fees": From c8b1351e87a656cb53ff2d89af086894edb28497 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 19 Apr 2019 20:06:48 +0530 Subject: [PATCH 15/39] fix: fetch party account as discounted receivable account in payment entry --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index ec35f030d3..b7ab4fea13 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -827,7 +827,7 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount= # party account if dt == "Sales Invoice": - party_account = get_party_account_based_on_invoice_discounting(dn) or ref_doc.debit_to + party_account = get_party_account_based_on_invoice_discounting(dn) or doc.debit_to elif dt == "Purchase Invoice": party_account = doc.credit_to elif dt == "Fees": From 98390dae49d9ffee3030813b581dd5e5adb27dcf Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Fri, 19 Apr 2019 21:52:08 +0530 Subject: [PATCH 16/39] fix: Do not create employee user permission if already exists --- erpnext/hr/doctype/employee/employee.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py index a403c393b9..48957e5819 100755 --- a/erpnext/hr/doctype/employee/employee.py +++ b/erpnext/hr/doctype/employee/employee.py @@ -80,6 +80,14 @@ class Employee(NestedSet): if not self.create_user_permission: return if not has_permission('User Permission', ptype='write'): return + employee_user_permission_exists = frappe.db.exists('User Permission', { + 'allow': 'Employee', + 'for_value': self.name, + 'user': self.user_id + }) + + if employee_user_permission_exists: return + add_user_permission("Employee", self.name, self.user_id) set_user_permission_if_allowed("Company", self.company, self.user_id) From d21bacfc211055b1ee63365f897158af812f7888 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Sat, 20 Apr 2019 10:57:04 +0530 Subject: [PATCH 17/39] fix: Total row alignment in AR report --- .../report/accounts_receivable/accounts_receivable.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html index 5ce80d1baf..1bff93cb77 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html @@ -107,8 +107,8 @@ {% if(report.report_name === "Accounts Receivable" || report.report_name === "Accounts Payable") { %} - {%= __("Date") %} - {%= __("Age (Days)") %} + {%= __("Date") %} + {%= __("Age (Days)") %} {% if(report.report_name === "Accounts Receivable" && filters.show_sales_person_in_print) { %} {%= __("Reference") %} @@ -206,7 +206,7 @@ {% if(!filters.show_pdc_in_print) { %} {% } %} - {% if(report.report_name === "Accounts Receivable") { %} + {% if(report.report_name === "Accounts Receivable" && filters.show_sales_person_in_print) { %} {% } %} From 079684f7da051784a1304b77bda558f4b1d75f8c Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Sat, 20 Apr 2019 23:37:49 +0530 Subject: [PATCH 18/39] feat: Task type (#17311) * feat: Add task type doctype --- erpnext/projects/doctype/task/task.json | 83 +++++++++++- .../projects/doctype/task_type/__init__.py | 0 .../projects/doctype/task_type/task_type.js | 8 ++ .../projects/doctype/task_type/task_type.json | 127 ++++++++++++++++++ .../projects/doctype/task_type/task_type.py | 10 ++ .../doctype/task_type/test_task_type.py | 10 ++ 6 files changed, 233 insertions(+), 5 deletions(-) create mode 100644 erpnext/projects/doctype/task_type/__init__.py create mode 100644 erpnext/projects/doctype/task_type/task_type.js create mode 100644 erpnext/projects/doctype/task_type/task_type.json create mode 100644 erpnext/projects/doctype/task_type/task_type.py create mode 100644 erpnext/projects/doctype/task_type/test_task_type.py diff --git a/erpnext/projects/doctype/task/task.json b/erpnext/projects/doctype/task/task.json index 707db0812a..4012346da1 100644 --- a/erpnext/projects/doctype/task/task.json +++ b/erpnext/projects/doctype/task/task.json @@ -20,6 +20,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "subject", "fieldtype": "Data", "hidden": 0, @@ -52,6 +53,7 @@ "bold": 1, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "project", "fieldtype": "Link", "hidden": 0, @@ -86,6 +88,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "issue", "fieldtype": "Link", "hidden": 0, @@ -112,6 +115,40 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "type", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Type", + "length": 0, + "no_copy": 0, + "options": "Task Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_in_quick_entry": 0, @@ -120,6 +157,7 @@ "collapsible": 0, "columns": 0, "default": "0", + "fetch_if_empty": 0, "fieldname": "is_group", "fieldtype": "Check", "hidden": 0, @@ -152,6 +190,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break0", "fieldtype": "Column Break", "hidden": 0, @@ -185,6 +224,7 @@ "bold": 1, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "status", "fieldtype": "Select", "hidden": 0, @@ -219,6 +259,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "priority", "fieldtype": "Select", "hidden": 0, @@ -253,6 +294,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "color", "fieldtype": "Color", "hidden": 0, @@ -285,6 +327,7 @@ "bold": 1, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "parent_task", "fieldtype": "Link", "hidden": 0, @@ -320,6 +363,7 @@ "collapsible_depends_on": "eval:doc.__islocal", "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "sb_timeline", "fieldtype": "Section Break", "hidden": 0, @@ -353,6 +397,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "exp_start_date", "fieldtype": "Date", "hidden": 0, @@ -389,6 +434,7 @@ "default": "0", "depends_on": "", "description": "", + "fetch_if_empty": 0, "fieldname": "expected_time", "fieldtype": "Float", "hidden": 0, @@ -423,6 +469,8 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_from": "type.weight", + "fetch_if_empty": 0, "fieldname": "task_weight", "fieldtype": "Float", "hidden": 0, @@ -455,6 +503,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_11", "fieldtype": "Column Break", "hidden": 0, @@ -487,6 +536,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "exp_end_date", "fieldtype": "Date", "hidden": 0, @@ -521,6 +571,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "progress", "fieldtype": "Percent", "hidden": 0, @@ -554,6 +605,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "is_milestone", "fieldtype": "Check", "hidden": 0, @@ -588,6 +640,7 @@ "collapsible_depends_on": "", "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "sb_details", "fieldtype": "Section Break", "hidden": 0, @@ -622,6 +675,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "description", "fieldtype": "Text Editor", "hidden": 0, @@ -659,6 +713,7 @@ "collapsible_depends_on": "", "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "sb_depends_on", "fieldtype": "Section Break", "hidden": 0, @@ -692,6 +747,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "depends_on", "fieldtype": "Table", "hidden": 0, @@ -726,6 +782,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "depends_on_tasks", "fieldtype": "Data", "hidden": 1, @@ -761,6 +818,7 @@ "columns": 0, "depends_on": "", "description": "", + "fetch_if_empty": 0, "fieldname": "sb_actual", "fieldtype": "Section Break", "hidden": 0, @@ -796,6 +854,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "act_start_date", "fieldtype": "Date", "hidden": 0, @@ -832,6 +891,7 @@ "default": "", "depends_on": "", "description": "", + "fetch_if_empty": 0, "fieldname": "actual_time", "fieldtype": "Float", "hidden": 0, @@ -865,6 +925,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_15", "fieldtype": "Column Break", "hidden": 0, @@ -897,6 +958,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "act_end_date", "fieldtype": "Date", "hidden": 0, @@ -931,6 +993,7 @@ "collapsible": 1, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "sb_costing", "fieldtype": "Section Break", "hidden": 0, @@ -964,6 +1027,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "total_costing_amount", "fieldtype": "Currency", "hidden": 0, @@ -999,6 +1063,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "total_expense_claim", "fieldtype": "Currency", "hidden": 0, @@ -1032,6 +1097,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_20", "fieldtype": "Column Break", "hidden": 0, @@ -1064,6 +1130,7 @@ "collapsible": 0, "columns": 0, "depends_on": "", + "fetch_if_empty": 0, "fieldname": "total_billing_amount", "fieldtype": "Currency", "hidden": 0, @@ -1096,6 +1163,7 @@ "bold": 0, "collapsible": 1, "columns": 0, + "fetch_if_empty": 0, "fieldname": "sb_more_info", "fieldtype": "Section Break", "hidden": 0, @@ -1128,6 +1196,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.status == \"Closed\" || doc.status == \"Pending Review\"", + "fetch_if_empty": 0, "fieldname": "review_date", "fieldtype": "Date", "hidden": 0, @@ -1162,6 +1231,7 @@ "collapsible": 0, "columns": 0, "depends_on": "eval:doc.status == \"Closed\"", + "fetch_if_empty": 0, "fieldname": "closing_date", "fieldtype": "Date", "hidden": 0, @@ -1195,6 +1265,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_22", "fieldtype": "Column Break", "hidden": 0, @@ -1225,6 +1296,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "department", "fieldtype": "Link", "hidden": 0, @@ -1258,6 +1330,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "company", "fieldtype": "Link", "hidden": 0, @@ -1290,6 +1363,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "lft", "fieldtype": "Int", "hidden": 1, @@ -1322,6 +1396,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "rgt", "fieldtype": "Int", "hidden": 1, @@ -1354,6 +1429,7 @@ "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "old_parent", "fieldtype": "Data", "hidden": 1, @@ -1381,18 +1457,16 @@ } ], "has_web_view": 0, - "hide_heading": 0, "hide_toolbar": 0, "icon": "fa fa-check", "idx": 1, - "image_view": 0, "in_create": 0, "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 5, "menu_index": 0, - "modified": "2019-04-18 12:22:02.147606", + "modified": "2019-04-20 22:45:20.777600", "modified_by": "Administrator", "module": "Projects", "name": "Task", @@ -1420,7 +1494,6 @@ ], "quick_entry": 0, "read_only": 0, - "read_only_onload": 0, "search_fields": "subject", "show_name_in_global_search": 1, "sort_order": "DESC", @@ -1429,4 +1502,4 @@ "track_changes": 0, "track_seen": 1, "track_views": 0 -} +} \ No newline at end of file diff --git a/erpnext/projects/doctype/task_type/__init__.py b/erpnext/projects/doctype/task_type/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/projects/doctype/task_type/task_type.js b/erpnext/projects/doctype/task_type/task_type.js new file mode 100644 index 0000000000..c1be5da4f6 --- /dev/null +++ b/erpnext/projects/doctype/task_type/task_type.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('Task Type', { + // refresh: function(frm) { + + // } +}); diff --git a/erpnext/projects/doctype/task_type/task_type.json b/erpnext/projects/doctype/task_type/task_type.json new file mode 100644 index 0000000000..3254444a48 --- /dev/null +++ b/erpnext/projects/doctype/task_type/task_type.json @@ -0,0 +1,127 @@ +{ + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "Prompt", + "beta": 0, + "creation": "2019-04-19 15:04:05.317138", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 0, + "engine": "InnoDB", + "fields": [ + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "weight", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Weight", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_if_empty": 0, + "fieldname": "description", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + } + ], + "has_web_view": 0, + "hide_toolbar": 0, + "idx": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2019-04-19 15:31:48.080164", + "modified_by": "Administrator", + "module": "Projects", + "name": "Task Type", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "ASC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 +} \ No newline at end of file diff --git a/erpnext/projects/doctype/task_type/task_type.py b/erpnext/projects/doctype/task_type/task_type.py new file mode 100644 index 0000000000..9c0b5325c6 --- /dev/null +++ b/erpnext/projects/doctype/task_type/task_type.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 TaskType(Document): + pass diff --git a/erpnext/projects/doctype/task_type/test_task_type.py b/erpnext/projects/doctype/task_type/test_task_type.py new file mode 100644 index 0000000000..1db6e27ed7 --- /dev/null +++ b/erpnext/projects/doctype/task_type/test_task_type.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 TestTaskType(unittest.TestCase): + pass From 733ff48d51a4136727cfca0fa4b660e00ba0e1ec Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 22 Apr 2019 12:08:18 +0530 Subject: [PATCH 19/39] fix: Refactor for Print Format changes (#17242) - Rename Server to Jinja - Rename Js to JS --- .../cheque_print_template/cheque_print_template.py | 12 ++++++------ erpnext/accounts/doctype/pos_profile/pos_profile.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py index 24cd3dda9b..d62ee9deeb 100644 --- a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py +++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py @@ -18,14 +18,14 @@ def create_or_update_cheque_print_format(template_name): "doc_type": "Payment Entry", "standard": "No", "custom_format": 1, - "print_format_type": "Server", + "print_format_type": "Jinja", "name": template_name }) else: cheque_print = frappe.get_doc("Print Format", template_name) - + doc = frappe.get_doc("Cheque Print Template", template_name) - + cheque_print.html = """