12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- # -*- coding: utf-8 -*-
- from openerp import models, fields, api
- class ResCurrency(models.Model):
- _inherit = 'res.currency'
- _name = 'res.currency'
- local_name = fields.Char('Local Name')
- decimal_separator = fields.Selection([('.', '.'),(',', ',')],'Decimal Separator', default=",", required=True)
- decimal_places = fields.Integer(string='Decimal Places', default=0, required=True)
- thousands_separator = fields.Selection([('.', '.'),(',', ',')],'thousands Separator', default=".", required=True)
- symbol_position = fields.Selection([('before', 'Antes del importe'),('after', 'Después del importe')],'Symbol Position', default="before", required=True)
- '''
- Deactivate currency
- '''
- def update_active_currency(self):
- return self.env.cr.execute('update res_currency set active=%s where active=%s', ('False','True'))
- @api.model
- def currency_utility(self):
- ## Desactivar todas las moneda
- self.update_active_currency()
- ## Actualizar Moneda Guarani
- currency_pyg = self.env['res.currency'].search([('name', '=', 'PYG'),('active','=',False)])
- currency_pyg.write({
- 'decimal_separator': ',',
- 'decimal_places': 0,
- 'thousands_separator' : '.',
- 'symbol_position' : 'before',
- 'local_name': 'Guaraníes',
- 'active': True,
- } )
- ## Actualizar Moneda Rela brasil
- currency_brl = self.env['res.currency'].search([('name', '=', 'BRL'),('active','=',False)])
- currency_brl.write({
- 'decimal_separator': ',',
- 'decimal_places': 2,
- 'thousands_separator': '.',
- 'symbol_position': 'before',
- 'local_name': 'Real',
- 'active': True,
- })
- ## Actualizar Moneda Peso Argentino
- currency_ars = self.env['res.currency'].search([('name', '=', 'ARS'),('active','=',False)])
- currency_ars.write({
- 'decimal_separator': ',',
- 'decimal_places': 2,
- 'thousands_separator': '.',
- 'symbol_position': 'before',
- 'local_name': 'Peso Argentino',
- 'active': True
- })
- ## Actualizar Moneda Dolar
- currency_usd = self.env['res.currency'].search([('name', '=', 'USD'),('active','=',False)])
- currency_usd.write({
- 'decimal_separator': '.',
- 'decimal_places': 2,
- 'thousands_separator': ',',
- 'symbol_position': 'before',
- 'local_name': 'Dólares',
- 'active': True,
- })
|