account_move_line.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # -*- coding: utf-8 -*-
  2. from openerp.http import request as r
  3. def get_account_move_line():
  4. user_store = r.env.user.store_id.id
  5. company_currency_rate = r.env.user.company_id.currency_id.rate
  6. query = '''
  7. SELECT
  8. move.id,
  9. move_line.id,
  10. account.id,
  11. move.name,
  12. move_line.debit,
  13. move_line.credit,
  14. move_line.date_maturity,
  15. move_line.reconcile_ref,
  16. account.type,
  17. move_line.reconcile_partial_id
  18. FROM account_move AS move
  19. LEFT JOIN account_move_line AS move_line
  20. ON move_line.move_id = move.id
  21. LEFT JOIN account_account AS account
  22. ON account.id = move_line.account_id
  23. ORDER BY move_line.date_maturity
  24. '''
  25. r.cr.execute(query)
  26. return [
  27. {
  28. 'move_id': j[0],
  29. 'move_line_id': j[1],
  30. 'account_id': j[2],
  31. 'name': j[3],
  32. 'debit': j[4],
  33. 'credit': j[5],
  34. 'date_maturity': j[6],
  35. 'reconcile_ref':j[7],
  36. 'type':j[8],
  37. 'reconcile_partial_id':j[9],
  38. } for j in r.cr.fetchall()
  39. ]