Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

48 wiersze
1.8 KiB

  1. # Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
  2. #
  3. # MIT License (MIT)
  4. #
  5. # Permission is hereby granted, free of charge, to any person obtaining a
  6. # copy of this software and associated documentation files (the "Software"),
  7. # to deal in the Software without restriction, including without limitation
  8. # the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. # and/or sell copies of the Software, and to permit persons to whom the
  10. # Software is furnished to do so, subject to the following conditions:
  11. #
  12. # The above copyright notice and this permission notice shall be included in
  13. # all copies or substantial portions of the Software.
  14. #
  15. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  16. # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  17. # PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  18. # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
  19. # CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
  20. # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. #
  22. # Modules
  23. # -----------
  24. def get_module_items(mod, only_dt=0):
  25. dl = []
  26. if only_dt:
  27. transfer_types = ['DocType']
  28. else:
  29. transfer_types = ['Role', 'Page', 'DocType', 'DocType Mapper', 'Search Criteria']
  30. dl = ['Module Def,'+mod]
  31. for dt in transfer_types:
  32. try:
  33. dl2 = sql('select name from `tab%s` where module="%s"' % (dt,mod))
  34. dl += [(dt+','+e[0]) for e in dl2]
  35. except:
  36. pass
  37. if not only_dt:
  38. dl1 = sql('select doctype_list from `tabModule Def` where name=%s', mod)
  39. dl += dl1[0][0].split('\n')
  40. # build finally
  41. dl = [e.split(',') for e in dl]
  42. dl = [[e[0].strip(), e[1].strip()] for e in dl] # remove blanks
  43. return dl