12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- # -*- coding: utf-8 -*-
- from openerp.http import request as r
- def get_res_company():
- 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,
- 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_partner AS partner
- ON partner.id = company.partner_id
- WHERE currency.active = true
- '''
- 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],
- },
- 'ruc': j[9],
- } for j in r.cr.fetchall()
- ]
- def get_res_company_logo():
- values = []
- for company in r.env['res.company'].search([]):
- values.append({
- 'id': company.id,
- 'name': company.name,
- 'logo': company.logo,
- })
- return values
|