From 8e3e04fa37257066c54b4d6a4394b4d854adcc93 Mon Sep 17 00:00:00 2001 From: Ashna-v Date: Thu, 9 Nov 2023 16:34:19 +0530 Subject: [PATCH] feat: Added a department Smith and designation smith --- aumms/fixtures/designation.json | 10 ++++++++++ aumms/hooks.py | 4 ++-- aumms/setup.py | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 aumms/fixtures/designation.json diff --git a/aumms/fixtures/designation.json b/aumms/fixtures/designation.json new file mode 100644 index 00000000..532921ca --- /dev/null +++ b/aumms/fixtures/designation.json @@ -0,0 +1,10 @@ +[ + { + "description": null, + "designation_name": "Smith", + "docstatus": 0, + "doctype": "Designation", + "modified": "2023-11-09 16:31:17.044970", + "name": "Smith" + } +] \ No newline at end of file diff --git a/aumms/hooks.py b/aumms/hooks.py index 7e94f650..7a65d0bc 100644 --- a/aumms/hooks.py +++ b/aumms/hooks.py @@ -39,7 +39,7 @@ 'Purchase Order': 'public/js/purchase_order.js', 'Sales Order' : 'public/js/sales_order.js', 'Job Card' : 'public/js/job_card.js' - + } # doctype_list_js = {"doctype" : "public/js/doctype_list.js"} # doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"} @@ -87,7 +87,7 @@ # ------------ fixtures = [{"dt": "Role","filters": [["name", "in", ["Design Analyst", "Supervisor","Smith","Head of Smith"]]]}, - {"dt":"Department","filters":[["name","in",["Smith"]]]}, + {"dt":"Designation","filters":[["name","in",["Smith"]]]}, ] # before_uninstall = "aumms.uninstall.before_uninstall" # after_uninstall = "aumms.uninstall.after_uninstall" diff --git a/aumms/setup.py b/aumms/setup.py index d381ecdd..37fd925a 100644 --- a/aumms/setup.py +++ b/aumms/setup.py @@ -14,6 +14,7 @@ def setup_aumms_defaults(): create_default_aumms_item_group() create_old_gold_aumms_item_group() create_all_smith_warehouse() + create_department_for_smith() def enable_common_party_accounting(): """ @@ -63,3 +64,16 @@ def create_all_smith_warehouse(): warehouse_doc.is_group = 1 warehouse_doc.insert(ignore_permissions = True) frappe.db.commit() + +def create_department_for_smith(): + ''' Method to create smith department on after migrate ''' + default_company = frappe.db.get_single_value('Global Defaults', 'default_company') + department = frappe.get_value('Department',{'department_name': 'All Departments'}) + if not frappe.db.exists('Department', {'department_name': 'Smith'}): + department_doc = frappe.new_doc('Department') + department_doc.company = default_company + department_doc.department_name = 'Smith' + department_doc.parent_warehouse = department + department_doc.is_group = 1 + department_doc.insert(ignore_permissions = True) + frappe.db.commit()