|
@@ -1,14 +1,19 @@
|
|
|
# -*- coding: utf-8 -*-
|
|
|
from openerp.http import request
|
|
|
|
|
|
-_MODEL = 'res.currency'
|
|
|
-
|
|
|
|
|
|
def check_base_currency():
|
|
|
- base_currency = request.env[_MODEL].search([('base', '=', True)])
|
|
|
+ company_currency = request.env.user.company_id.currency_id
|
|
|
+ other_currencies = request.env['res.currency'].search([('base', '=', True), ('id', '!=', company_currency.id)])
|
|
|
+
|
|
|
+ if other_currencies:
|
|
|
+ for c in other_currencies:
|
|
|
+ c.write({
|
|
|
+ 'base': False
|
|
|
+ })
|
|
|
|
|
|
- if not base_currency:
|
|
|
- request.env.user.company_id.currency_id.write({
|
|
|
+ if not company_currency.base:
|
|
|
+ company_currency.write({
|
|
|
'base': True
|
|
|
})
|
|
|
|