mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-18 09:12:03 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
53
odoo-bringout-oca-rest-framework-rest_log/rest_log/hooks.py
Normal file
53
odoo-bringout-oca-rest-framework-rest_log/rest_log/hooks.py
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# Copyright 2021 Camptocamp SA (http://www.camptocamp.com)
|
||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
|
||||
import logging
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def post_init_hook(cr, version):
|
||||
"""Preserve log entries from old implementation in shopfloor."""
|
||||
cr.execute("SELECT 1 FROM pg_class WHERE relname = 'shopfloor_log'")
|
||||
if not cr.fetchone():
|
||||
# shopfloor_log was already removed
|
||||
return
|
||||
|
||||
_logger.info("Copy shopfloor.log records to rest.log")
|
||||
cr.execute(
|
||||
"""
|
||||
INSERT INTO rest_log (
|
||||
request_url,
|
||||
request_method,
|
||||
params,
|
||||
headers,
|
||||
result,
|
||||
error,
|
||||
exception_name,
|
||||
exception_message,
|
||||
state,
|
||||
severity,
|
||||
create_uid,
|
||||
create_date,
|
||||
write_uid,
|
||||
write_date
|
||||
)
|
||||
SELECT
|
||||
request_url,
|
||||
request_method,
|
||||
params,
|
||||
headers,
|
||||
result,
|
||||
error,
|
||||
exception_name,
|
||||
exception_message,
|
||||
state,
|
||||
severity,
|
||||
create_uid,
|
||||
create_date,
|
||||
write_uid,
|
||||
write_date
|
||||
FROM shopfloor_log;
|
||||
"""
|
||||
)
|
||||
_logger.info("Delete legacy records in shopfloor_log")
|
||||
cr.execute("""DELETE FROM shopfloor_log""")
|
||||
Loading…
Add table
Add a link
Reference in a new issue