account_analytic_account.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # -*- coding: utf-8 -*-
  2. from openerp.http import request as r
  3. def get_contracts_inmobiliaria():
  4. query = '''
  5. SELECT
  6. contract.id,
  7. contract.code,
  8. contract.partner_id,
  9. contract.state,
  10. contract.date,
  11. contract.description,
  12. contract.name,
  13. contract.recurring_next_date,
  14. contract.recurring_rule_type,
  15. contract.nro_cuotas,
  16. contract.cuota_total,
  17. partner.name,
  18. contract.date_start
  19. FROM account_analytic_account AS contract
  20. LEFT JOIN res_partner AS partner
  21. ON partner.id = contract.partner_id
  22. '''
  23. r.cr.execute(query)
  24. return [
  25. {
  26. 'id': j[0],
  27. 'code': j[1],
  28. 'partner_id': j[2],
  29. 'state': j[3],
  30. 'date': j[4],
  31. 'description': j[5],
  32. 'name': j[6],
  33. 'recurring_next_date': j[7],
  34. 'recurring_rule_type': j[8],
  35. 'nro_cuotas': j[9],
  36. 'cuota_total': j[10],
  37. 'partner_name': j[11],
  38. 'date_start':j[12],
  39. } for j in r.cr.fetchall()
  40. ]