dashboard_objetive.py 747 B

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. from openerp.http import request as r
  3. def get_dashboard_objetive_widget():
  4. user_store = r.env.user.store_id.id
  5. query = '''
  6. SELECT store_id,
  7. date,
  8. sale_objetive,
  9. purchase_limit,
  10. expense_limit,
  11. payment_objetive
  12. FROM dashboard_objetive
  13. WHERE TO_CHAR(date,'YYYY-MM') = TO_CHAR(current_date,'YYYY-MM')
  14. AND store_id = ''' + str(user_store) + '''
  15. '''
  16. r.cr.execute(query)
  17. return [
  18. {
  19. 'store_id': j[0],
  20. 'date': j[1],
  21. 'sale_objetive': j[2],
  22. 'purchase_limit': j[3],
  23. 'expense_limit': j[4],
  24. 'payment_objetive': j[5]
  25. } for j in r.cr.fetchall()
  26. ]