[FIX] base: _get_eval_domain with localcontext
Before this commit, it was impossible to eval the domain if context_today was used in domain. closes odoo/odoo#34031 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import ast
|
||||
import datetime
|
||||
|
||||
from odoo import api, fields, models, tools, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
|
||||
|
||||
class IrFilters(models.Model):
|
||||
@@ -41,7 +42,10 @@ class IrFilters(models.Model):
|
||||
@api.multi
|
||||
def _get_eval_domain(self):
|
||||
self.ensure_one()
|
||||
return ast.literal_eval(self.domain)
|
||||
return safe_eval(self.domain, {
|
||||
'datetime': datetime,
|
||||
'context_today': datetime.datetime.now,
|
||||
})
|
||||
|
||||
@api.model
|
||||
def _get_action_domain(self, action_id=None):
|
||||
|
||||
Reference in New Issue
Block a user