[FIX] base: currency exchange rate date

When creating a new exchange rate, the default date is always the date
of the last server restart.

This is because `fields.Date.today() + ' 00:00:00'` is a fixed string
and the field is instanciated only at startup.

opw-684622
This commit is contained in:
Nicolas Martinelli
2016-08-01 13:29:16 +02:00
parent 9b5fed4976
commit 2ee4afda2f
+1 -1
View File
@@ -227,7 +227,7 @@ class CurrencyRate(models.Model):
_description = "Currency Rate"
_order = "name desc"
name = fields.Datetime(string='Date', required=True, index=True, default=fields.Date.today() + ' 00:00:00')
name = fields.Datetime(string='Date', required=True, index=True, default=lambda self:fields.Date.today() + ' 00:00:00')
rate = fields.Float(digits=(12, 6), help='The rate of the currency to the currency of rate 1')
currency_id = fields.Many2one('res.currency', string='Currency', readonly=True)
company_id = fields.Many2one('res.company', string='Company')