diff --git a/jey_erp/hooks.py b/jey_erp/hooks.py index cbec3ca..98bf06b 100644 --- a/jey_erp/hooks.py +++ b/jey_erp/hooks.py @@ -80,6 +80,8 @@ doc_events = { # Asset categories are now created automatically via Company.on_update event # setup_wizard_complete = "jey_erp.setup.setup_wizard_handler.setup_wizard_complete_handler" +setup_wizard_complete = "jey_erp.setup.setup_wizard_handler.create_test_salary_component" + after_migrate = "jey_erp.hooks.after_migrate_combined" def after_migrate_combined(): diff --git a/jey_erp/setup/setup_wizard_handler.py b/jey_erp/setup/setup_wizard_handler.py index 39626d8..441536a 100644 --- a/jey_erp/setup/setup_wizard_handler.py +++ b/jey_erp/setup/setup_wizard_handler.py @@ -1,6 +1,20 @@ import frappe +def create_test_salary_component(args): + if frappe.db.exists("Salary Component", "TEST COMP"): + return + + doc = frappe.get_doc({ + "doctype": "Salary Component", + "salary_component": "TEST COMP", + "salary_component_abbr": "TC", + "type": "Earning", + }) + doc.insert(ignore_permissions=True) + frappe.db.commit() + + def setup_wizard_complete_handler(args): """ Вызывается после завершения ERPNext setup wizard.