res_currency.py 782 B

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. from openerp.http import request
  3. _MODEL = 'res.currency'
  4. def check_base_currency():
  5. base_currency = request.env[_MODEL].search([('base', '=', True)])
  6. if not base_currency:
  7. request.env.user.company_id.currency_id.write({
  8. 'base': True
  9. })
  10. def get_base_currency():
  11. currency = request.env.user.company_id.currency_id
  12. return {
  13. 'id': currency.id,
  14. 'name': currency.display_name,
  15. 'base': currency.base,
  16. 'symbol': currency.symbol,
  17. 'position': currency.position,
  18. 'rateSilent': currency.rate_silent,
  19. 'decimalSeparator': currency.decimal_separator,
  20. 'decimalPlaces': currency.decimal_places,
  21. 'thousandsSeparator': currency.thousands_separator
  22. }