[FIX] report: create a new environment
self is a rml_parse instance, not a BaseModel create new environment to call ORM methods prevent crash when calling formatLang on a RML report Closes #24068
This commit is contained in:
committed by
Martin Trigaux
parent
a93a5c6824
commit
c41f7297d3
@@ -220,7 +220,8 @@ class rml_parse(object):
|
||||
date = datetime(*value.timetuple()[:6])
|
||||
if date_time:
|
||||
# Convert datetime values to the expected client/context timezone
|
||||
record = self.env['base'].with_context(self.localcontext)
|
||||
env = odoo.api.Environment(self.cr, self.uid, {})
|
||||
record = env['base'].with_context(self.localcontext)
|
||||
date = fields.Datetime.context_timestamp(record, date)
|
||||
return date.strftime(date_format.encode('utf-8'))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user