1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# Currency rate date check module for OpenERP
5
# Copyright (C) 2012 Akretion (http://www.akretion.com). All Rights Reserved
6
# @author Alexis de Lattre <alexis.delattre@akretion.com>
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU Affero General Public License as
10
# published by the Free Software Foundation, either version 3 of the
11
# License, or (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU Affero General Public License for more details.
18
# You should have received a copy of the GNU Affero General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
##############################################################################
23
from osv import osv, fields
25
class res_company(osv.osv):
26
_inherit = 'res.company'
29
'currency_rate_max_delta': fields.integer('Max time delta in days for currency rates', help="This is the maximum interval in days between the date associated with the amount to convert and the currency rate available in OpenERP with the nearest date."),
33
'currency_rate_max_delta': lambda *a: 7,
36
def _check_currency_rate_max_delta(self, cr, uid, ids):
37
for company in self.read(cr, uid, ids, ['currency_rate_max_delta']):
38
if company['currency_rate_max_delta'] >= 0:
45
(_check_currency_rate_max_delta, "The value must be positive", ['currency_rate_max_delta']),