app_name = "nse_erp"
app_title = "NSE ERP"
app_publisher = "NSE ERP Demo"
app_description = "NSE Financial ERP demo - gap-fill doctypes over ERPNext"
app_email = "fredrickmutui6400@gmail.com"
app_license = "mit"

# Apps
# ------------------

# required_apps = []

# Each item in the list will be shown as an app in the apps page
# add_to_apps_screen = [
# 	{
# 		"name": "nse_erp",
# 		"logo": "/assets/nse_erp/logo.png",
# 		"title": "NSE ERP",
# 		"route": "/nse_erp",
# 		"has_permission": "nse_erp.api.permission.has_app_permission"
# 	}
# ]

# Includes in <head>
# ------------------

# include js, css files in header of desk.html
# app_include_css = "/assets/nse_erp/css/nse_erp.css"
# app_include_js = "/assets/nse_erp/js/nse_erp.js"

# include js, css files in header of web template
# web_include_css = "/assets/nse_erp/css/nse_erp.css"
# web_include_js = "/assets/nse_erp/js/nse_erp.js"

# include custom scss in every website theme (without file extension ".scss")
# website_theme_scss = "nse_erp/public/scss/website"

# include js, css files in header of web form
# webform_include_js = {"doctype": "public/js/doctype.js"}
# webform_include_css = {"doctype": "public/css/doctype.css"}

# include js in page
# page_js = {"page" : "public/js/file.js"}

# include js in doctype views
# doctype_js = {"doctype" : "public/js/doctype.js"}
# doctype_list_js = {"doctype" : "public/js/doctype_list.js"}
# doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"}
# doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"}

# Svg Icons
# ------------------
# include app icons in desk
# app_include_icons = "nse_erp/public/icons.svg"

# Home Pages
# ----------

# application home page (will override Website Settings)
# home_page = "login"

# website user home page (by Role)
# role_home_page = {
# 	"Role": "home_page"
# }

# Generators
# ----------

# automatically create page for each record of this doctype
# website_generators = ["Web Page"]

# Jinja
# ----------

# add methods and filters to jinja environment
# jinja = {
# 	"methods": "nse_erp.utils.jinja_methods",
# 	"filters": "nse_erp.utils.jinja_filters"
# }

# Installation
# ------------

# before_install = "nse_erp.install.before_install"
# after_install = "nse_erp.install.after_install"

# Uninstallation
# ------------

# before_uninstall = "nse_erp.uninstall.before_uninstall"
# after_uninstall = "nse_erp.uninstall.after_uninstall"

# Integration Setup
# ------------------
# To set up dependencies/integrations with other apps
# Name of the app being installed is passed as an argument

# before_app_install = "nse_erp.utils.before_app_install"
# after_app_install = "nse_erp.utils.after_app_install"

# Integration Cleanup
# -------------------
# To clean up dependencies/integrations with other apps
# Name of the app being uninstalled is passed as an argument

# before_app_uninstall = "nse_erp.utils.before_app_uninstall"
# after_app_uninstall = "nse_erp.utils.after_app_uninstall"

# Desk Notifications
# ------------------
# See frappe.core.notifications.get_notification_config

# notification_config = "nse_erp.notifications.get_notification_config"

# Permissions
# -----------
# Permissions evaluated in scripted ways

# permission_query_conditions = {
# 	"Event": "frappe.desk.doctype.event.event.get_permission_query_conditions",
# }
#
# has_permission = {
# 	"Event": "frappe.desk.doctype.event.event.has_permission",
# }

# DocType Class
# ---------------
# Override standard doctype classes

# override_doctype_class = {
# 	"ToDo": "custom_app.overrides.CustomToDo"
# }

# Document Events
# ---------------
# Hook on document methods and events

doc_events = {
	"Purchase Invoice": {
		"validate": "nse_erp.nse_erp.prepayment_engine.validate_prepayment_dates",
		"before_submit": "nse_erp.nse_erp.match_tolerance.check_three_way_match",
		"on_submit": [
			"nse_erp.nse_erp.doa_routing.route_for_approval",
			"nse_erp.nse_erp.gl_coding_anomaly.check_coding_anomaly",
		],
	},
	"Material Request": {
		"validate": "nse_erp.nse_erp.budget_control.flag_budget_warning",
		"on_update": "nse_erp.nse_erp.variance_commentary.maybe_generate_commentary",
	},
	"Purchase Order": {
		"validate": [
			"nse_erp.nse_erp.budget_control.flag_budget_warning",
			"nse_erp.nse_erp.supplier_prequalification_gate.check_supplier_prequalified",
		],
		"on_update": "nse_erp.nse_erp.variance_commentary.maybe_generate_commentary",
		"on_submit": [
			"nse_erp.nse_erp.lpo_dispatch.send_lpo_to_supplier",
			"nse_erp.nse_erp.doa_routing.route_for_approval",
		],
	},
	"Employee Advance": {
		"on_submit": "nse_erp.nse_erp.advance_liquidation_monitor.check_advance_liquidation",
	},
	"NSE Petty Cash Voucher": {
		"on_submit": "nse_erp.nse_erp.petty_cash_controller.on_submit_petty_cash_voucher",
	},
	"Journal Entry": {
		"on_submit": [
			"nse_erp.nse_erp.remittance_dispatch.on_journal_entry_submit",
			"nse_erp.nse_erp.intercompany_transaction_hook.mirror_on_behalf_of_transaction",
		],
	},
	"Contract": {
		"on_update": "nse_erp.nse_erp.contract_to_gl.generate_billing_for_contract",
	},
	"Supplier Prequalification": {
		"validate": [
			"nse_erp.nse_erp.conflict_of_interest_check.check_supplier_conflict_of_interest",
			"nse_erp.nse_erp.debarment_check.check_not_debarred",
		],
	},
	"Communication": {
		# Not after_insert: InboundMail.receive() (frappe/email/receive.py)
		# calls communication.insert() BEFORE save_attachments_in_doc(), then
		# a second communication.save() afterwards - attachments only exist
		# by the time on_update fires.
		"on_update": "nse_erp.nse_erp.invoice_inbox_bot.process_inbound_invoice_email",
	},
}

# Scheduled Tasks
# ---------------

scheduler_events = {
	"hourly": [
		"nse_erp.nse_erp.escalation_engine.check_pending_approvals_and_escalate",
	],
	"daily": [
		"nse_erp.nse_erp.supplier_prequalification_expiry.check_expired_documents",
		"nse_erp.nse_erp.exchange_rate_fetcher.sync_exchange_rates",
		"nse_erp.nse_erp.fx_revaluation_engine.run_fx_revaluation",
		"nse_erp.nse_erp.dunning_engine.run_ar_dunning_process",
		"nse_erp.nse_erp.ai_cash_matcher.auto_match_cash_application",
		"nse_erp.nse_erp.ifrs15_revenue_engine.process_revenue_recognition",
		"nse_erp.nse_erp.contract_expiry_alerts.check_contract_expiry",
		"nse_erp.nse_erp.bank_statement_bot.fetch_bank_statements",
		"nse_erp.nse_erp.auto_reconciliation_engine.run_auto_reconciliation",
		"nse_erp.nse_erp.advance_liquidation_monitor.send_overdue_advance_alerts",
		"nse_erp.nse_erp.petty_cash_controller.audit_receipts",
		"nse_erp.nse_erp.accrued_interest_engine.run_daily_accrual",
		"nse_erp.nse_erp.accrued_interest_engine.process_maturities",
		"nse_erp.nse_erp.gl_integrity_scanner.scan_duplicate_gl_postings",
		"nse_erp.nse_erp.quote_comparison.check_rfqs_needing_quotes",
		"nse_erp.nse_erp.accrual_benchmark_check.check_accrual_benchmarks",
	],
	"monthly": [
		"nse_erp.nse_erp.run_elimination.run_monthly_elimination",
		"nse_erp.nse_erp.variance_commentary.run_pl_variance_sweep",
		"nse_erp.nse_erp.board_book_generator.run_monthly_board_book_distribution",
		"nse_erp.nse_erp.rolling_forecast_engine.run_rolling_forecast",
		"nse_erp.nse_erp.prepayment_engine.run_prepayment_amortization",
		"nse_erp.nse_erp.missing_accrual_report.flag_missing_accruals",
	],
}

# Testing
# -------

# before_tests = "nse_erp.install.before_tests"

# Overriding Methods
# ------------------------------
#
# override_whitelisted_methods = {
# 	"frappe.desk.doctype.event.event.get_events": "nse_erp.event.get_events"
# }
#
# each overriding function accepts a `data` argument;
# generated from the base implementation of the doctype dashboard,
# along with any modifications made in other Frappe apps
# override_doctype_dashboards = {
# 	"Task": "nse_erp.task.get_dashboard_data"
# }

# exempt linked doctypes from being automatically cancelled
#
# auto_cancel_exempted_doctypes = ["Auto Repeat"]

# Ignore links to specified DocTypes when deleting documents
# -----------------------------------------------------------

# ignore_links_on_delete = ["Communication", "ToDo"]

# Request Events
# ----------------
# before_request = ["nse_erp.utils.before_request"]
# after_request = ["nse_erp.utils.after_request"]

# Job Events
# ----------
# before_job = ["nse_erp.utils.before_job"]
# after_job = ["nse_erp.utils.after_job"]

# User Data Protection
# --------------------

# user_data_fields = [
# 	{
# 		"doctype": "{doctype_1}",
# 		"filter_by": "{filter_by}",
# 		"redact_fields": ["{field_1}", "{field_2}"],
# 		"partial": 1,
# 	},
# 	{
# 		"doctype": "{doctype_2}",
# 		"filter_by": "{filter_by}",
# 		"partial": 1,
# 	},
# 	{
# 		"doctype": "{doctype_3}",
# 		"strict": False,
# 	},
# 	{
# 		"doctype": "{doctype_4}"
# 	}
# ]

# Authentication and authorization
# --------------------------------

# auth_hooks = [
# 	"nse_erp.auth.validate"
# ]

# Automatically update python controller files with type annotations for this app.
# export_python_type_annotations = True

# default_log_clearing_doctypes = {
# 	"Logging DocType Name": 30  # days to retain logs
# }

# Translation
# ------------
# List of apps whose translatable strings should be excluded from this app's translations.
# ignore_translatable_strings_from = []
