# -*- coding: utf-8 -*- from openerp.http import request as r def get_account_journal(): user_store = r.env.user.store_id.id query = ''' SELECT aj.id, aj.name, aj.code, aj.type, rs.store_id FROM account_journal AS aj LEFT JOIN res_store_journal_rel AS rs ON aj.id = rs.journal_id WHERE aj.active = true AND aj.type in ('sale', 'purchase', 'sale_refund', 'purchase_refund') ORDER BY aj.id ''' r.cr.execute(query) return [ { 'id': j[0], 'name': j[1], 'code': j[2], 'type': j[3], 'store_id': j[4] } for j in r.cr.fetchall() ]