# -*- coding: utf-8-*- from openerp.http import request as r def check_base_currency(): base_currency = r.env['res.currency'].search([('base', '=', True)]) if not base_currency: r.env.user.company_id.currency_id.write({ 'base': True }) def get_currency_id(journal_id): j = r.env['account.journal'].browse(journal_id) return j.default_debit_account_id.currency_id.id or j.default_debit_account_id.company_currency_id.id def get_base_currency(): currency = r.env.user.company_id.currency_id return { 'id': currency.id, 'name': currency.display_name, 'base': currency.base, 'symbol': currency.symbol, 'position': currency.position, 'rateSilent': currency.rate_silent, 'decimalSeparator': currency.decimal_separator, 'decimalPlaces': currency.decimal_places, 'thousandsSeparator': currency.thousands_separator }