account_analytic_invoice_line.py 815 B

123456789101112131415161718192021222324252627282930313233343536
  1. # -*- coding: utf-8 -*-
  2. from openerp.http import request as r
  3. def get_contract_line_inmobiliaria():
  4. query = '''
  5. SELECT
  6. line.id,
  7. line.analytic_account_id,
  8. line.name,
  9. line.quantity,
  10. line.price_unit,
  11. tmp.t_manzana,
  12. tmp.t_lote,
  13. tmp.t_nro
  14. FROM account_analytic_invoice_line AS line
  15. LEFT JOIN product_product AS product
  16. ON line.product_id = product.id
  17. LEFT JOIN product_template AS tmp
  18. ON product.product_tmpl_id = tmp.id
  19. '''
  20. r.cr.execute(query)
  21. return [
  22. {
  23. 'id': j[0],
  24. 'analytic_account_id': j[1],
  25. 'name': j[2],
  26. 'quantity': j[3],
  27. 'price_unit': j[4],
  28. 't_manzana': j[5],
  29. 't_lote': j[6],
  30. 't_nro': j[7],
  31. } for j in r.cr.fetchall()
  32. ]