# -*- coding: utf-8 -*- from openerp.http import request as r def get_contracts_inmobiliaria(): query = ''' SELECT contract.id, contract.code, contract.partner_id, contract.state, contract.date, contract.description, contract.name, contract.recurring_next_date, contract.recurring_rule_type, contract.nro_cuotas, contract.cuota_total, partner.name FROM account_analytic_account AS contract LEFT JOIN res_partner AS partner ON partner.id = contract.partner_id ''' r.cr.execute(query) return [ { 'id': j[0], 'code': j[1], 'partner_id': j[2], 'state': j[3], 'date': j[4], 'description': j[5], 'name': j[6], 'recurring_next_date': j[7], 'recurring_rule_type': j[8], 'nro_cuotas': j[9], 'cuota_total': j[10], 'partner_name': j[11], } for j in r.cr.fetchall() ]