# -*- coding: utf-8 -*- from openerp.http import request as r _MODEL = 'res.company' def get_company_logo(): domain = [ # ('expense','=', True) ] return [ { 'id': company.id, 'logo': company.logo, } for company in r.env[_MODEL].search(domain) ] def get_res_company(): user_company = r.env.user.company_id.id user_store = r.env.user.store_id.id query = ''' SELECT company.id, company.name, currency.id, currency.name, currency.symbol, currency.decimal_places, currency.decimal_separator, currency.thousands_separator, currency.symbol_position, store.name AS store, partner.ruc AS company_ruc FROM res_company AS company LEFT JOIN res_currency AS currency ON company.currency_id = currency.id LEFT JOIN res_store AS store ON store.id = ''' + str(user_store) + ''' LEFT JOIN res_partner AS partner ON partner.id = company.partner_id WHERE currency.active = true ORDER BY company.id ASC ''' r.cr.execute(query) return [ { 'id': j[0], 'name': j[1], 'currency_id':{ 'id': j[2], 'name': j[3], 'symbol': j[4], 'decimal_places': j[5], 'decimal_separator': j[6], 'thousands_separator': j[7], 'symbol_position': j[8], }, 'store': j[9], 'ruc': j[10], } for j in r.cr.fetchall() ]