Skip to content

Commit

Permalink
Merge pull request #296 from royleviindoo/fix_disable_invalid_filters
Browse files Browse the repository at this point in the history
[FIX] disable_invalid_filters: datetime / context_today / relativedelta is not defined
  • Loading branch information
pedrobaeza authored Jul 14, 2022
2 parents 0e45373 + 1c991df commit c9fa9b0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions openupgradelib/openupgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -2372,6 +2372,18 @@ def format_message(f):
globaldict = {'uid': env.uid}
if version_info[0] < 14:
globaldict.update({'time': time})
if version_info[0] >= 13:
try:
from odoo.tools.safe_eval import datetime as safe_eval_datetime
from odoo.tools.safe_eval import dateutil
except ImportError:
import datetime as safe_eval_datetime
import dateutil
globaldict.update({
'datetime': safe_eval_datetime,
'context_today': safe_eval_datetime.datetime.now,
'relativedelta': dateutil.relativedelta.relativedelta,
})
# DOMAIN
try:
with savepoint(env.cr):
Expand Down

0 comments on commit c9fa9b0

Please sign in to comment.