mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[IMP] Add last_execution_uid field + bypass orm to avoid impactif sql.export write_date/uid on query execution
This commit is contained in:
@@ -63,7 +63,21 @@ class SqlFileWizard(models.TransientModel):
|
||||
% {"name": sql_export.name, "date": date, "extension": extension},
|
||||
}
|
||||
)
|
||||
sql_export.write({"last_run": fields.Datetime.now()})
|
||||
# Bypass ORM to avoid changing the write_date/uid from sql query on a simple
|
||||
# execution. This also avoid error if user has no update right on the
|
||||
# sql.export object.
|
||||
self.env.cr.execute(
|
||||
"""
|
||||
UPDATE sql_export
|
||||
SET last_execution_date = %s, last_execution_uid = %s
|
||||
WHERE id = %s
|
||||
""",
|
||||
(
|
||||
fields.Datetime.to_string(fields.Datetime.now()),
|
||||
self.env.user.id,
|
||||
sql_export.id,
|
||||
),
|
||||
)
|
||||
action = {
|
||||
"name": "SQL Export",
|
||||
"type": "ir.actions.act_url",
|
||||
|
||||
Reference in New Issue
Block a user