12345678910111213141516171819202122232425262728293031323334 |
- # -*- coding: utf-8 -*-
- from openerp import api, models, fields
- from openerp.tools.safe_eval import safe_eval
- class ResConfig(models.TransientModel):
- _inherit = 'res.config.settings'
- image_type = fields.Selection(selection=[('small', 'Pequeña'), ('big', 'Grande')], default='small', string='Imagen', required=True)
- allow_currency_exchange = fields.Boolean(default=False, string='Permitir cambiar moneda')
- view_currency_exchanges = fields.Boolean(default=False, string='Permitir ver cambio de monedas')
- currency_ids = fields.Many2many('res.currency', string='Monedas')
- '''
- '''
- @api.multi
- def set_default_settings(self):
- ir_config = self.env['ir.config_parameter']
-
- ir_config.set_param('eiru_pos.image_type', str(self.image_type))
- ir_config.set_param('eiru_pos.allow_currency_exchange', repr(self.allow_currency_exchange))
- ir_config.set_param('eiru_pos.view_currency_exchanges', repr(self.view_currency_exchanges))
- ir_config.set_param('eiru_pos.currency_ids', repr(self.currency_ids.mapped(lambda x: x.id)))
- @api.model
- def get_default_settings(self, fields):
- ir_config = self.env['ir.config_parameter']
- res_currency = self.env['res.currency']
- return {
- 'image_type': ir_config.get_param('eiru_pos.image_type', 'small'),
- 'allow_currency_exchange': safe_eval(ir_config.get_param('eiru_pos.allow_currency_exchange', 'False')),
- 'view_currency_exchanges': safe_eval(ir_config.get_param('eiru_pos.view_currency_exchanges', 'False')),
- 'currency_ids': safe_eval(ir_config.get_param('eiru_pos.currency_ids', '[]'))
- }
|