12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- # -*- coding: utf-8 -*-
- from openerp.http import request as r
- def get_company_info():
- user_company = r.env.user.company_id.id
- user_store = r.env.user.store_id.id
- query = '''
- SELECT
- company.id,
- company.name,
- currency.id,
- currency.name,
- currency.symbol,
- currency.decimal_places,
- currency.decimal_separator,
- currency.thousands_separator,
- currency.symbol_position,
- store.name AS store,
- partner.ruc AS company_ruc
- FROM res_company AS company
- LEFT JOIN res_currency AS currency
- ON company.currency_id = currency.id
- LEFT JOIN res_store AS store
- ON store.id = ''' + str(user_store) + '''
- LEFT JOIN res_partner AS partner
- ON partner.id = company.partner_id
- WHERE currency.active = true
- AND company.id = ''' + str(user_company) + '''
- '''
- r.cr.execute(query)
- return [
- {
- 'id': j[0],
- 'name': j[1],
- 'currency_id':{
- 'id': j[2],
- 'name': j[3],
- 'symbol': j[4],
- 'decimal_places': j[5],
- 'decimal_separator': j[6],
- 'thousands_separator': j[7],
- 'symbol_position': j[8],
- },
- 'store': j[9],
- 'ruc': j[10],
- } for j in r.cr.fetchall()
- ]
|