widget_list.py 674 B

123456789101112131415161718192021222324252627
  1. # -*- coding: utf-8 -*-
  2. from openerp.http import request as r
  3. def get_widget_list():
  4. user_id = r.env.user.id
  5. query = '''
  6. SELECT
  7. --users.id,
  8. --partner.name,
  9. chart.name
  10. FROM res_users AS users
  11. --LEFT JOIN res_partner AS partner
  12. --ON partner.id = users.partner_id
  13. LEFT JOIN chart_list_users_rel AS chart_rel
  14. ON chart_rel.user_id = users.id
  15. LEFT JOIN chart_list AS chart
  16. ON chart.id = chart_rel.chart_id
  17. WHERE users.id = ''' + str(user_id) + '''
  18. '''
  19. r.cr.execute(query)
  20. return [
  21. {
  22. 'name': j[0],
  23. } for j in r.cr.fetchall()
  24. ]