You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 11 година
пре 12 година
пре 12 година
пре 12 година
пре 12 година
пре 12 година
пре 12 година
пре 12 година
12345678910111213141516171819202122232425262728293031
  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")