account_analytic_account.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. FROM account_analytic_account AS contract
  19. LEFT JOIN res_partner AS partner
  20. ON partner.id = contract.partner_id
  21. '''
  22. r.cr.execute(query)
  23. return [
  24. {
  25. 'id': j[0],
  26. 'code': j[1],
  27. 'partner_id': j[2],
  28. 'state': j[3],
  29. 'date': j[4],
  30. 'description': j[5],
  31. 'name': j[6],
  32. 'recurring_next_date': j[7],
  33. 'recurring_rule_type': j[8],
  34. 'nro_cuotas': j[9],
  35. 'cuota_total': j[10],
  36. 'partner_name': j[11],
  37. } for j in r.cr.fetchall()
  38. ]