123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- # -*- coding: utf-8 -*-
- from openerp.http import request
- _MODEL = 'res.config.settings'
- '''
- '''
- def get_pos_config():
- config = request.env[_MODEL].search([], limit=1, order='id desc')
- return {
- 'imageType': config.image_type,
- 'allowCurrencyExchange': config.allow_currency_exchange,
- 'viewCurrencyExchanges': config.view_currency_exchanges,
- 'currencies': [
- {
- 'id': currency.id,
- 'name': currency.display_name,
- 'symbol': currency.symbol,
- 'position': currency.position,
- 'rateSilent': currency.rate_silent,
- 'decimalSeparator': currency.decimal_separator,
- 'decimalPlaces': currency.decimal_places,
- 'thousandsSeparator': currency.thousands_separator
- } for currency in config.currency_ids
- ]
- }
- '''
- '''
- def save_pos_config(**kw):
- values = {}
-
- if kw.get('setting') == 'imageType':
- values['image_type'] = ('big', 'small')[kw.get('value', False)]
-
- if kw.get('setting') == 'allowCurrencyExchange':
- values['allow_currency_exchange'] = kw.get('value', False)
-
- if kw.get('setting') == 'viewCurrencyExchanges':
- values['view_currency_exchanges'] = kw.get('value', False)
- settings = request.env[_MODEL].search([], limit=1, order='id desc')
- settings.write(values)
- settings.execute()
-
- return get_pos_config()
-
|