From 7376b4f4f0e3e6ffbc00d9b925ab176c83c336e6 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Wed, 22 May 2019 11:29:01 +0530 Subject: [PATCH 1/5] feat: added warehouse type master --- .../stock/doctype/warehouse/warehouse.json | 859 ++---------------- .../stock/doctype/warehouse_type/__init__.py | 0 .../warehouse_type/test_warehouse_type.py | 10 + .../doctype/warehouse_type/warehouse_type.js | 8 + .../warehouse_type/warehouse_type.json | 39 + .../doctype/warehouse_type/warehouse_type.py | 10 + .../report/stock_balance/stock_balance.js | 17 +- 7 files changed, 153 insertions(+), 790 deletions(-) create mode 100644 erpnext/stock/doctype/warehouse_type/__init__.py create mode 100644 erpnext/stock/doctype/warehouse_type/test_warehouse_type.py create mode 100644 erpnext/stock/doctype/warehouse_type/warehouse_type.js create mode 100644 erpnext/stock/doctype/warehouse_type/warehouse_type.json create mode 100644 erpnext/stock/doctype/warehouse_type/warehouse_type.py diff --git a/erpnext/stock/doctype/warehouse/warehouse.json b/erpnext/stock/doctype/warehouse/warehouse.json index 63e374f6d7..646725956d 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.json +++ b/erpnext/stock/doctype/warehouse/warehouse.json @@ -1,1005 +1,286 @@ { - "allow_copy": 0, - "allow_guest_to_view": 0, "allow_import": 1, "allow_rename": 1, - "beta": 0, "creation": "2013-03-07 18:50:32", - "custom": 0, "description": "A logical Warehouse against which stock entries are made.", - "docstatus": 0, "doctype": "DocType", "document_type": "Setup", - "editable_grid": 0, + "field_order": [ + "warehouse_detail", + "warehouse_name", + "is_group", + "company", + "disabled", + "column_break_4", + "account", + "warehouse_type", + "address_and_contact", + "address_html", + "column_break_10", + "contact_html", + "warehouse_contact_info", + "email_id", + "phone_no", + "mobile_no", + "column_break0", + "address_line_1", + "address_line_2", + "city", + "state", + "pin", + "tree_details", + "parent_warehouse", + "lft", + "rgt", + "old_parent" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "warehouse_detail", "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": "Warehouse Detail", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Section Break", - "permlevel": 0, - "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 + "oldfieldtype": "Section Break" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "description": "If blank, parent Warehouse Account or company default will be considered", "fieldname": "warehouse_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": "Warehouse Name", - "length": 0, - "no_copy": 0, "oldfieldname": "warehouse_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": 0 + "reqd": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, "bold": 1, - "collapsible": 0, - "columns": 0, "default": "0", "fieldname": "is_group", "fieldtype": "Check", - "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": "Is Group", - "length": 0, - "no_copy": 0, - "options": "", - "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 + "label": "Is Group" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "company", "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": 1, "label": "Company", - "length": 0, - "no_copy": 0, "oldfieldname": "company", "oldfieldtype": "Link", "options": "Company", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, "remember_last_selected_value": 1, - "report_hide": 0, "reqd": 1, - "search_index": 1, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "search_index": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, + "default": "0", "fieldname": "disabled", "fieldtype": "Check", - "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": "Disabled", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "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 + "label": "Disabled" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "column_break_4", - "fieldtype": "Column 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, - "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 + "fieldtype": "Column Break" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "account", "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": "Account", - "length": 0, - "no_copy": 0, - "options": "Account", - "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 + "options": "Account" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "address_and_contact", "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": "Address and Contact", - "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 + "label": "Address and Contact" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "address_html", "fieldtype": "HTML", - "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": "Address HTML", - "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 + "label": "Address HTML" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "column_break_10", - "fieldtype": "Column 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, - "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 + "fieldtype": "Column Break" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "contact_html", "fieldtype": "HTML", - "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": "Contact HTML", - "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 + "label": "Contact HTML" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, "collapsible": 1, - "columns": 0, - "description": "", "fieldname": "warehouse_contact_info", "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": "Warehouse Contact Info", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "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 + "label": "Warehouse Contact Info" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "email_id", "fieldtype": "Data", "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "Email Address", - "length": 0, - "no_copy": 0, "oldfieldname": "email_id", - "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": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "oldfieldtype": "Data" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "phone_no", "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": "Phone No", - "length": 0, - "no_copy": 0, "oldfieldname": "phone_no", "oldfieldtype": "Int", - "options": "Phone", - "permlevel": 0, - "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 + "options": "Phone" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "mobile_no", "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": "Mobile No", - "length": 0, - "no_copy": 0, "oldfieldname": "mobile_no", "oldfieldtype": "Int", - "options": "Phone", - "permlevel": 0, - "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 + "options": "Phone" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "column_break0", "fieldtype": "Column 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, - "length": 0, - "no_copy": 0, - "oldfieldtype": "Column Break", - "permlevel": 0, - "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 + "oldfieldtype": "Column Break" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "address_line_1", "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": "Address Line 1", - "length": 0, - "no_copy": 0, "oldfieldname": "address_line_1", - "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": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "oldfieldtype": "Data" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "address_line_2", "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": "Address Line 2", - "length": 0, - "no_copy": 0, "oldfieldname": "address_line_2", - "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": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "oldfieldtype": "Data" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "city", "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": "City", - "length": 0, - "no_copy": 0, "oldfieldname": "city", - "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": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "oldfieldtype": "Data" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "state", "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": "State", - "length": 0, - "no_copy": 0, "oldfieldname": "state", - "oldfieldtype": "Select", - "permlevel": 0, - "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 + "oldfieldtype": "Select" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "pin", "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": "PIN", - "length": 0, - "no_copy": 0, "oldfieldname": "pin", - "oldfieldtype": "Int", - "permlevel": 0, - "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 + "oldfieldtype": "Int" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, "collapsible": 1, - "columns": 0, "fieldname": "tree_details", "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": "Tree Details", - "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 + "label": "Tree Details" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, "bold": 1, - "collapsible": 0, - "columns": 0, "fieldname": "parent_warehouse", "fieldtype": "Link", - "hidden": 0, "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "Parent Warehouse", - "length": 0, - "no_copy": 0, "options": "Warehouse", - "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": 1, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "search_index": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "lft", "fieldtype": "Int", "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "lft", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "read_only": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "rgt", "fieldtype": "Int", "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "rgt", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "read_only": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "old_parent", "fieldtype": "Link", "hidden": 1, "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "Old Parent", - "length": 0, - "no_copy": 0, "options": "Warehouse", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "read_only": 1 + }, + { + "depends_on": "eval:(!doc.is_group);", + "fieldname": "warehouse_type", + "fieldtype": "Link", + "label": "Warehouse Type", + "options": "Warehouse Type" } ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, "icon": "fa fa-building", "idx": 1, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2018-08-29 06:26:49.647225", + "modified": "2019-05-22 11:17:23.357490", "modified_by": "Administrator", "module": "Stock", "name": "Warehouse", "owner": "Administrator", "permissions": [ { - "amend": 0, - "cancel": 0, "create": 1, "delete": 1, "email": 1, "export": 1, - "if_owner": 0, "import": 1, - "permlevel": 0, "print": 1, "read": 1, "report": 1, "role": "Item Manager", "set_user_permissions": 1, "share": 1, - "submit": 0, "write": 1 }, { - "amend": 0, - "cancel": 0, - "create": 0, - "delete": 0, "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, "print": 1, "read": 1, "report": 1, - "role": "Stock User", - "set_user_permissions": 0, - "share": 0, - "submit": 0, - "write": 0 + "role": "Stock User" }, { - "amend": 0, - "cancel": 0, - "create": 0, - "delete": 0, "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, "print": 1, "read": 1, "report": 1, - "role": "Sales User", - "set_user_permissions": 0, - "share": 0, - "submit": 0, - "write": 0 + "role": "Sales User" }, { - "amend": 0, - "cancel": 0, - "create": 0, - "delete": 0, "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, "print": 1, "read": 1, "report": 1, - "role": "Purchase User", - "set_user_permissions": 0, - "share": 0, - "submit": 0, - "write": 0 + "role": "Purchase User" }, { - "amend": 0, - "cancel": 0, - "create": 0, - "delete": 0, "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, "print": 1, "read": 1, "report": 1, - "role": "Accounts User", - "set_user_permissions": 0, - "share": 0, - "submit": 0, - "write": 0 + "role": "Accounts User" }, { - "amend": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 0, "read": 1, - "report": 0, - "role": "Manufacturing User", - "set_user_permissions": 0, - "share": 0, - "submit": 0, - "write": 0 + "role": "Manufacturing User" } ], "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "search_fields": "", "show_name_in_global_search": 1, "sort_order": "DESC", - "title_field": "warehouse_name", - "track_changes": 0, - "track_seen": 0, - "track_views": 0 + "title_field": "warehouse_name" } \ No newline at end of file diff --git a/erpnext/stock/doctype/warehouse_type/__init__.py b/erpnext/stock/doctype/warehouse_type/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py b/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py new file mode 100644 index 0000000000..39f4b2391b --- /dev/null +++ b/erpnext/stock/doctype/warehouse_type/test_warehouse_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 TestWarehouseType(unittest.TestCase): + pass diff --git a/erpnext/stock/doctype/warehouse_type/warehouse_type.js b/erpnext/stock/doctype/warehouse_type/warehouse_type.js new file mode 100644 index 0000000000..4c4b89ce30 --- /dev/null +++ b/erpnext/stock/doctype/warehouse_type/warehouse_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('Warehouse Type', { + // refresh: function(frm) { + + // } +}); diff --git a/erpnext/stock/doctype/warehouse_type/warehouse_type.json b/erpnext/stock/doctype/warehouse_type/warehouse_type.json new file mode 100644 index 0000000000..905bb4f136 --- /dev/null +++ b/erpnext/stock/doctype/warehouse_type/warehouse_type.json @@ -0,0 +1,39 @@ +{ + "autoname": "Prompt", + "creation": "2019-05-21 15:27:06.514511", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "description" + ], + "fields": [ + { + "fieldname": "description", + "fieldtype": "Small Text", + "label": "Description" + } + ], + "modified": "2019-05-21 15:30:06.754938", + "modified_by": "Administrator", + "module": "Stock", + "name": "Warehouse Type", + "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": "ASC", + "track_changes": 1 +} \ No newline at end of file diff --git a/erpnext/stock/doctype/warehouse_type/warehouse_type.py b/erpnext/stock/doctype/warehouse_type/warehouse_type.py new file mode 100644 index 0000000000..4b7d8d829f --- /dev/null +++ b/erpnext/stock/doctype/warehouse_type/warehouse_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 WarehouseType(Document): + pass diff --git a/erpnext/stock/report/stock_balance/stock_balance.js b/erpnext/stock/report/stock_balance/stock_balance.js index 839ed7ab5b..93ce897b8d 100644 --- a/erpnext/stock/report/stock_balance/stock_balance.js +++ b/erpnext/stock/report/stock_balance/stock_balance.js @@ -49,7 +49,22 @@ frappe.query_reports["Stock Balance"] = { "label": __("Warehouse"), "fieldtype": "Link", "width": "80", - "options": "Warehouse" + "options": "Warehouse", + get_query: () => { + var warehouse_type = frappe.query_report.get_filter_value('warehouse_type'); + return { + filters: { + 'warehouse_type': warehouse_type + } + } + } + }, + { + "fieldname": "warehouse_type", + "label": __("Warehouse Type"), + "fieldtype": "Link", + "width": "80", + "options": "Warehouse Type" }, { "fieldname":"include_uom", From 61a7b42aea63f49ff3a1b7e49d7b2edc37e482a5 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Thu, 23 May 2019 14:31:22 +0530 Subject: [PATCH 2/5] fix: added permission and fix filters in stock balance report --- .../warehouse_type/warehouse_type.json | 59 ++++++++++++++++++- .../report/stock_balance/stock_balance.js | 8 ++- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/warehouse_type/warehouse_type.json b/erpnext/stock/doctype/warehouse_type/warehouse_type.json index 905bb4f136..905942e33e 100644 --- a/erpnext/stock/doctype/warehouse_type/warehouse_type.json +++ b/erpnext/stock/doctype/warehouse_type/warehouse_type.json @@ -13,7 +13,7 @@ "label": "Description" } ], - "modified": "2019-05-21 15:30:06.754938", + "modified": "2019-05-23 14:30:11.435978", "modified_by": "Administrator", "module": "Stock", "name": "Warehouse Type", @@ -30,6 +30,63 @@ "role": "System Manager", "share": 1, "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Item Manager", + "share": 1, + "write": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales User", + "share": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Stock User", + "share": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase User", + "share": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts User", + "share": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Manufacturing User", + "share": 1 } ], "quick_entry": 1, diff --git a/erpnext/stock/report/stock_balance/stock_balance.js b/erpnext/stock/report/stock_balance/stock_balance.js index 93ce897b8d..07e5f4b3d7 100644 --- a/erpnext/stock/report/stock_balance/stock_balance.js +++ b/erpnext/stock/report/stock_balance/stock_balance.js @@ -52,9 +52,11 @@ frappe.query_reports["Stock Balance"] = { "options": "Warehouse", get_query: () => { var warehouse_type = frappe.query_report.get_filter_value('warehouse_type'); - return { - filters: { - 'warehouse_type': warehouse_type + if(warehouse_type){ + return { + filters: { + 'warehouse_type': warehouse_type + } } } } From 32c23ae2740f18c0af6cc33a9697b6abf4cd2ca0 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Mon, 27 May 2019 18:36:31 +0530 Subject: [PATCH 3/5] fix: added read write permission to stock manager --- .../doctype/warehouse_type/warehouse_type.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/warehouse_type/warehouse_type.json b/erpnext/stock/doctype/warehouse_type/warehouse_type.json index 905942e33e..9993bfd93f 100644 --- a/erpnext/stock/doctype/warehouse_type/warehouse_type.json +++ b/erpnext/stock/doctype/warehouse_type/warehouse_type.json @@ -13,7 +13,7 @@ "label": "Description" } ], - "modified": "2019-05-23 14:30:11.435978", + "modified": "2019-05-27 18:35:33.354571", "modified_by": "Administrator", "module": "Stock", "name": "Warehouse Type", @@ -43,6 +43,18 @@ "share": 1, "write": 1 }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Stock Manager", + "share": 1, + "write": 1 + }, { "email": 1, "export": 1, From 7f375d209c41c0cc5e59f355e031a4346dc6ab91 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 27 May 2019 18:42:20 +0530 Subject: [PATCH 4/5] fix: Tax calculation on salary slip --- erpnext/hr/doctype/salary_slip/salary_slip.py | 95 +++++++++++-------- .../doctype/salary_slip/test_salary_slip.py | 3 +- 2 files changed, 59 insertions(+), 39 deletions(-) diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index 125a8ae27c..6bba0c54d8 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -119,7 +119,7 @@ class SalarySlip(TransactionBase): if not self.salary_slip_based_on_timesheet: self.get_date_details() self.validate_dates() - joining_date, relieving_date = frappe.db.get_value("Employee", self.employee, + joining_date, relieving_date = frappe.get_cached_value("Employee", self.employee, ["date_of_joining", "relieving_date"]) self.get_leave_details(joining_date, relieving_date) @@ -183,7 +183,7 @@ class SalarySlip(TransactionBase): def get_leave_details(self, joining_date=None, relieving_date=None, lwp=None, for_preview=0): if not joining_date: - joining_date, relieving_date = frappe.db.get_value("Employee", self.employee, + joining_date, relieving_date = frappe.get_cached_value("Employee", self.employee, ["date_of_joining", "relieving_date"]) working_days = date_diff(self.end_date, self.start_date) + 1 @@ -300,9 +300,6 @@ class SalarySlip(TransactionBase): self.rounded_total = rounded(self.net_pay) - if self.net_pay < 0: - frappe.throw(_("Net Pay cannnot be negative")) - def calculate_component_amounts(self): if not getattr(self, '_salary_structure_doc', None): self._salary_structure_doc = frappe.get_doc('Salary Structure', self.salary_structure) @@ -313,6 +310,7 @@ class SalarySlip(TransactionBase): self.add_employee_benefits(payroll_period) self.add_additional_salary_components() self.add_tax_components(payroll_period) + self.set_component_amounts_based_on_payment_days() def add_structure_components(self): data = self.get_data_for_eval() @@ -404,14 +402,18 @@ class SalarySlip(TransactionBase): def add_tax_components(self, payroll_period): # Calculate variable_based_on_taxable_salary after all components updated in salary slip - struct_tax_components = [d.salary_component for d in self._salary_structure_doc.get("deductions") - if d.variable_based_on_taxable_salary == 1 and not d.formula and not d.amount] + tax_components, other_deduction_components = [], [] + for d in self._salary_structure_doc.get("deductions"): + if d.variable_based_on_taxable_salary == 1 and not d.formula and not flt(d.amount): + tax_components.append(d.salary_component) + else: + other_deduction_components.append(d.salary_component) - if not struct_tax_components: - struct_tax_components = [d.name for d in - frappe.get_all("Salary Component", filters={"variable_based_on_taxable_salary": 1})] + if not tax_components: + tax_components = [d.name for d in frappe.get_all("Salary Component", filters={"variable_based_on_taxable_salary": 1}) + if d.name not in other_deduction_components] - for d in struct_tax_components: + for d in tax_components: tax_amount = self.calculate_variable_based_on_taxable_salary(d, payroll_period) tax_row = self.get_salary_slip_row(d) self.update_component_row(tax_row, tax_amount, "deductions") @@ -477,8 +479,7 @@ class SalarySlip(TransactionBase): future_structured_taxable_earnings = current_taxable_earnings.taxable_earnings * (math.ceil(remaining_sub_periods) - 1) # get taxable_earnings, addition_earnings for current actual payment days - self.set_component_amounts_based_on_payment_days() - current_taxable_earnings_for_payment_days = self.get_taxable_earnings() + current_taxable_earnings_for_payment_days = self.get_taxable_earnings(based_on_payment_days=1) current_structured_taxable_earnings = current_taxable_earnings_for_payment_days.taxable_earnings current_additional_earnings = current_taxable_earnings_for_payment_days.additional_income current_additional_earnings_with_full_tax = current_taxable_earnings_for_payment_days.additional_income_with_full_tax @@ -501,7 +502,6 @@ class SalarySlip(TransactionBase): # Structured tax amount total_structured_tax_amount = self.calculate_tax_by_tax_slab(payroll_period, total_taxable_earnings_without_full_tax_addl_components) - current_structured_tax_amount = (total_structured_tax_amount - previous_total_paid_taxes) / remaining_sub_periods # Total taxable earnings with additional earnings with full tax @@ -560,25 +560,39 @@ class SalarySlip(TransactionBase): return total_tax_paid - def get_taxable_earnings(self, only_flexi=0): + def get_taxable_earnings(self, based_on_payment_days=0): + joining_date, relieving_date = frappe.get_cached_value("Employee", self.employee, + ["date_of_joining", "relieving_date"]) + + if not relieving_date: + relieving_date = getdate(self.end_date) + + if not joining_date: + frappe.throw(_("Please set the Date Of Joining for employee {0}").format(frappe.bold(self.employee_name))) + taxable_earnings = 0 additional_income = 0 additional_income_with_full_tax = 0 flexi_benefits = 0 for earning in self.earnings: + if based_on_payment_days: + amount, additional_amount = self.get_amount_based_on_payment_days(earning, joining_date, relieving_date) + else: + amount, additional_amount = earning.amount, earning.additional_amount + if earning.is_tax_applicable: - if flt(earning.additional_amount): - taxable_earnings += (earning.amount - earning.additional_amount) - additional_income += earning.additional_amount + if additional_amount: + taxable_earnings += (amount - additional_amount) + additional_income += additional_amount if earning.deduct_full_tax_on_selected_payroll_date: - additional_income_with_full_tax += earning.additional_amount + additional_income_with_full_tax += additional_amount continue if earning.is_flexible_benefit: - flexi_benefits += earning.amount + flexi_benefits += amount else: - taxable_earnings += earning.amount + taxable_earnings += amount return frappe._dict({ "taxable_earnings": taxable_earnings, @@ -587,6 +601,26 @@ class SalarySlip(TransactionBase): "flexi_benefits": flexi_benefits }) + def get_amount_based_on_payment_days(self, row, joining_date, relieving_date): + amount, additional_amount = row.amount, row.additional_amount + if (self.salary_structure and + cint(row.depends_on_payment_days) and cint(self.total_working_days) and + (not self.salary_slip_based_on_timesheet or + getdate(self.start_date) < joining_date or + getdate(self.end_date) > relieving_date + )): + additional_amount = flt((flt(row.additional_amount) * flt(self.payment_days) + / cint(self.total_working_days)), row.precision("additional_amount")) + amount = flt((flt(row.default_amount) * flt(self.payment_days) + / cint(self.total_working_days)), row.precision("amount")) + additional_amount + + elif not self.payment_days and not self.salary_slip_based_on_timesheet and cint(row.depends_on_payment_days): + amount, additional_amount = 0, 0 + elif not row.amount: + amount = row.default_amount + row.additional_amount + + return amount, additional_amount + def calculate_unclaimed_taxable_benefits(self, payroll_period): # get total sum of benefits paid total_benefits_paid = flt(frappe.db.sql(""" @@ -688,7 +722,7 @@ class SalarySlip(TransactionBase): return total def set_component_amounts_based_on_payment_days(self): - joining_date, relieving_date = frappe.db.get_value("Employee", self.employee, + joining_date, relieving_date = frappe.get_cached_value("Employee", self.employee, ["date_of_joining", "relieving_date"]) if not relieving_date: @@ -699,22 +733,7 @@ class SalarySlip(TransactionBase): for component_type in ("earnings", "deductions"): for d in self.get(component_type): - if (self.salary_structure and - cint(d.depends_on_payment_days) and cint(self.total_working_days) and - (not self.salary_slip_based_on_timesheet or - getdate(self.start_date) < joining_date or - getdate(self.end_date) > relieving_date - )): - - d.amount = flt( - (flt(d.default_amount + d.additional_amount) * flt(self.payment_days) - / cint(self.total_working_days)) - , d.precision("amount")) - - elif not self.payment_days and not self.salary_slip_based_on_timesheet and cint(d.depends_on_payment_days): - d.amount = 0 - elif not d.amount: - d.amount = d.default_amount + d.additional_amount + d.amount = self.get_amount_based_on_payment_days(d, joining_date, relieving_date)[0] def set_loan_repayment(self): self.set('loans', []) diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py index b7e0782001..b333f4f49e 100644 --- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py @@ -442,7 +442,8 @@ def make_deduction_salary_component(setup=False, test_tax=False): "formula": 'base*.1', "type": "Deduction", "amount_based_on_formula": 1, - "depends_on_payment_days": 0 + "depends_on_payment_days": 0, + "variable_based_on_taxable_salary": 1 } ] if not test_tax: From a69f72988a0d559e7457d3bb9967c2b570a07f20 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Tue, 28 May 2019 11:08:14 +0530 Subject: [PATCH 5/5] fix: requested filters changes --- erpnext/stock/report/stock_balance/stock_balance.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py index 0c71f9182e..8b6590d08e 100644 --- a/erpnext/stock/report/stock_balance/stock_balance.py +++ b/erpnext/stock/report/stock_balance/stock_balance.py @@ -113,6 +113,10 @@ def get_conditions(filters): where wh.lft >= %s and wh.rgt <= %s and sle.warehouse = wh.name)"%(warehouse_details.lft, warehouse_details.rgt) + if filters.get("warehouse_type") and not filters.get("warehouse"): + conditions += " and exists (select name from `tabWarehouse` wh \ + where wh.warehouse_type = '%s' and sle.warehouse = wh.name)"%(filters.get("warehouse_type")) + return conditions def get_stock_ledger_entries(filters, items):