Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added a department Smith and designation smith #184

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions aumms/fixtures/designation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"description": null,
"designation_name": "Smith",
"docstatus": 0,
"doctype": "Designation",
"modified": "2023-11-09 16:31:17.044970",
"name": "Smith"
}
]
4 changes: 2 additions & 2 deletions aumms/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down Expand Up @@ -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"
Expand Down
14 changes: 14 additions & 0 deletions aumms/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
"""
Expand Down Expand Up @@ -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()
Loading