12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- # -*- coding: utf-8 -*-
- from openerp.http import request as r
- def get_payments_journals_widget():
- user_store = r.env.user.store_id.id
- query = '''
- SELECT
- journal.id,
- journal.name,
- journal.code,
- journal.type,
- journal.currency,
- journal_rel.store_id,
- currency.symbol,
- currency.decimal_places,
- currency.thousands_separator,
- currency.decimal_separator
- FROM account_journal AS journal
- LEFT JOIN res_store_journal_rel AS journal_rel
- ON journal_rel.journal_id = journal.id
- LEFT JOIN res_currency AS currency
- ON currency.id = journal.currency
- WHERE journal.active = true
- AND journal.type in ('bank', 'cash')
- AND journal_rel.store_id = ''' + str(user_store) + '''
- '''
- r.cr.execute(query)
- return [
- {
- 'id': j[0],
- 'name': j[1],
- 'code': j[2],
- 'type': j[3],
- 'currency': j[4],
- 'store_id': j[5],
- 'symbol': j[6],
- 'decimal_places': j[7],
- 'thousands_separator': j[8],
- 'decimal_separator': j[9],
- } for j in r.cr.fetchall()
- ]
|