account_journal.py 682 B

1234567891011121314151617181920212223242526
  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', 'purchase', 'sale_refund', 'purchase_refund')
  12. ORDER BY aj.id
  13. '''
  14. r.cr.execute(query)
  15. return [
  16. {
  17. 'id': j[0],
  18. 'name': j[1],
  19. 'code': j[2],
  20. 'type': j[3],
  21. 'store_id': j[4]
  22. } for j in r.cr.fetchall()
  23. ]