hooks.py 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from . import __version__ as app_version
  4. app_name = "gtl_custom"
  5. app_title = "GTL Customisation"
  6. app_publisher = "Fafadia Tech"
  7. app_description = "Customisations done for GTL"
  8. app_icon = "octicon octicon-file-directory"
  9. app_color = "grey"
  10. app_email = "sidharth@fafadiatech.com"
  11. app_license = "MIT"
  12. from erpnext.controllers.accounts_controller import AccountsController
  13. def custom_validate_qty_is_not_zero(self):
  14. pass
  15. AccountsController.validate_qty_is_not_zero = custom_validate_qty_is_not_zero
  16. # Includes in <head>
  17. # ------------------
  18. # include js, css files in header of desk.html
  19. # app_include_css = "/assets/gtl_custom/css/gtl_custom.css"
  20. # app_include_js = "/assets/gtl_custom/js/gtl_custom.js"
  21. # include js, css files in header of web template
  22. # web_include_css = "/assets/gtl_custom/css/gtl_custom.css"
  23. # web_include_js = "/assets/gtl_custom/js/gtl_custom.js"
  24. # include js in page
  25. # page_js = {"page" : "public/js/file.js"}
  26. # include js in doctype views
  27. # doctype_js = {"doctype" : "public/js/doctype.js"}
  28. # doctype_list_js = {"doctype" : "public/js/doctype_list.js"}
  29. doctype_list_js = {"Purchase Order":"public/js/purchase_order_list.js"}
  30. # doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"}
  31. # doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"}
  32. # Home Pages
  33. # ----------
  34. # application home page (will override Website Settings)
  35. # home_page = "login"
  36. # website user home page (by Role)
  37. # role_home_page = {
  38. # "Role": "home_page"
  39. # }
  40. # Website user home page (by function)
  41. # get_website_user_home_page = "gtl_custom.utils.get_home_page"
  42. # Generators
  43. # ----------
  44. # automatically create page for each record of this doctype
  45. # website_generators = ["Web Page"]
  46. # Installation
  47. # ------------
  48. # before_install = "gtl_custom.install.before_install"
  49. # after_install = "gtl_custom.install.after_install"
  50. # Desk Notifications
  51. # ------------------
  52. # See frappe.core.notifications.get_notification_config
  53. # notification_config = "gtl_custom.notifications.get_notification_config"
  54. # Permissions
  55. # -----------
  56. # Permissions evaluated in scripted ways
  57. # permission_query_conditions = {
  58. # "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions",
  59. # }
  60. #
  61. # has_permission = {
  62. # "Event": "frappe.desk.doctype.event.event.has_permission",
  63. # }
  64. # Document Events
  65. # ---------------
  66. # Hook on document methods and events
  67. # doc_events = {
  68. # "*": {
  69. # "on_update": "method",
  70. # "on_cancel": "method",
  71. # "on_trash": "method"
  72. # }
  73. # }
  74. doc_events = {
  75. "Request for Quotation": {
  76. "validate": "gtl_custom.validations.rfq_validations"
  77. },
  78. "Quotation": {
  79. "validate": "gtl_custom.validations.quote_validations",
  80. "on_update": "gtl_custom.validations.quote_update",
  81. },
  82. "Purchase Order": {
  83. "validate": "gtl_custom.validations.purchase_order_validation"
  84. },
  85. "ToDo": {
  86. "validate": "gtl_custom.validations.todo_validation"
  87. }
  88. }
  89. # Scheduled Tasks
  90. # ---------------
  91. # scheduler_events = {
  92. # "all": [
  93. # "gtl_custom.tasks.all"
  94. # ],
  95. # "daily": [
  96. # "gtl_custom.tasks.daily"
  97. # ],
  98. # "hourly": [
  99. # "gtl_custom.tasks.hourly"
  100. # ],
  101. # "weekly": [
  102. # "gtl_custom.tasks.weekly"
  103. # ]
  104. # "monthly": [
  105. # "gtl_custom.tasks.monthly"
  106. # ]
  107. # }
  108. # Testing
  109. # -------
  110. # before_tests = "gtl_custom.install.before_tests"
  111. # Overriding Methods
  112. # ------------------------------
  113. #
  114. # override_whitelisted_methods = {
  115. # # "frappe.desk.doctype.event.event.get_events": "gtl_custom.event.get_events"
  116. # "erpnext.controllers.accounts_controller.AccountsController.validate_qty_is_not_zero": "gtl_custom.api.custom_validate_qty_is_not_zero"
  117. # }
  118. #
  119. # each overriding function accepts a `data` argument;
  120. # generated from the base implementation of the doctype dashboard,
  121. # along with any modifications made in other Frappe apps
  122. # override_doctype_dashboards = {
  123. # "Task": "gtl_custom.task.get_dashboard_data"
  124. # }