res_partner.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # -*- coding: utf-8 -*-
  2. from openerp.http import request as r
  3. def get_res_partner_inmobiliaria():
  4. query = '''
  5. SELECT
  6. partner.id,
  7. partner.name,
  8. partner.ruc
  9. FROM res_partner AS partner
  10. WHERE partner.customer = True AND partner.active = True
  11. '''
  12. r.cr.execute(query)
  13. return [
  14. {
  15. 'id': j[0],
  16. 'name': j[1],
  17. 'ruc': j[2],
  18. } for j in r.cr.fetchall()
  19. ]
  20. def get_all_res_partner_inmobiliaria():
  21. query = '''
  22. SELECT
  23. partner.id,
  24. partner.name,
  25. partner.ruc
  26. FROM res_partner AS partner
  27. WHERE partner.active = True
  28. '''
  29. r.cr.execute(query)
  30. return [
  31. {
  32. 'id': j[0],
  33. 'name': j[1],
  34. 'ruc': j[2],
  35. } for j in r.cr.fetchall()
  36. ]
  37. def get_supplier_inmobiliaria():
  38. query = '''
  39. SELECT
  40. partner.id,
  41. partner.name,
  42. partner.ruc
  43. FROM res_partner AS partner
  44. WHERE partner.supplier = true AND partner.active = true
  45. '''
  46. r.cr.execute(query)
  47. return [
  48. {
  49. 'id': j[0],
  50. 'name': j[1],
  51. 'ruc': j[2],
  52. } for j in r.cr.fetchall()
  53. ]