account_journal.py 613 B

12345678910111213141516171819202122232425
  1. # -*- coding: utf-8 -*-
  2. from openerp.http import request as r
  3. def get_account_journal():
  4. user_store = r.env.user.store_id.id
  5. query = '''
  6. SELECT aj.id, aj.name, aj.code, aj.type, rs.store_id
  7. FROM account_journal AS aj
  8. LEFT JOIN res_store_journal_rel AS rs
  9. ON aj.id = rs.journal_id
  10. WHERE aj.active = true
  11. AND aj.type in ('sale')
  12. '''
  13. r.cr.execute(query)
  14. return [
  15. {
  16. 'id': j[0],
  17. 'name': j[1],
  18. 'code': j[2],
  19. 'type': j[3],
  20. 'store_id': j[4]
  21. } for j in r.cr.fetchall()
  22. ]