Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

32 строки
1.0 KiB

  1. # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
  2. # MIT License. See license.txt
  3. from __future__ import unicode_literals
  4. import webnotes
  5. def get_workflow_name(doctype):
  6. if getattr(webnotes.local, "workflow_names", None) is None:
  7. webnotes.local.workflow_names = {}
  8. if doctype not in webnotes.local.workflow_names:
  9. workflow_name = webnotes.conn.get_value("Workflow", {"document_type": doctype,
  10. "is_active": "1"}, "name")
  11. # no active? get default workflow
  12. if not workflow_name:
  13. workflow_name = webnotes.conn.get_value("Workflow", {"document_type": doctype},
  14. "name")
  15. webnotes.local.workflow_names[doctype] = workflow_name
  16. return webnotes.local.workflow_names[doctype]
  17. def get_default_state(doctype):
  18. workflow_name = get_workflow_name(doctype)
  19. return webnotes.conn.get_value("Workflow Document State", {"parent": workflow_name,
  20. "idx":1}, "state")
  21. def get_state_fieldname(doctype):
  22. workflow_name = get_workflow_name(doctype)
  23. return webnotes.conn.get_value("Workflow", workflow_name, "workflow_state_field")