# -*- coding: utf-8 -*- from openerp.http import request _MODEL = 'res.store' ''' ''' def get_stores(company_id=None): domain = [] if company_id: domain.append(('company_id', '=', company_id)) store_obj = request.env[_MODEL] store_ids = store_obj.search(domain) return [{ 'id': store.id, 'name': store.display_name, 'parent': { 'id': store.parent_id.id or None }, 'company': { 'id': store.company_id.id or None }, 'journals': [{ 'id': journal.id, 'name': journal.display_name } for journal in store.journal_ids] } for store in store_ids]