mirror of
https://github.com/bringout/oca-storage.git
synced 2026-04-21 08:32:01 +02:00
Initial commit: OCA Storage packages (17 packages)
This commit is contained in:
commit
7a380f05d3
659 changed files with 41828 additions and 0 deletions
|
|
@ -0,0 +1,37 @@
|
|||
# Copyright 2023 ACSONE SA/NV
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
import logging
|
||||
|
||||
from odoo.tools.sql import column_exists
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def pre_init_hook(cr):
|
||||
"""Pre init hook."""
|
||||
# add columns for computed fields to avoid useless computation by the ORM
|
||||
# when installing the module
|
||||
if column_exists(cr, "ir_attachment", "fs_storage_id"):
|
||||
return # columns already added; update probably failed partway
|
||||
_logger.info("Add columns for computed fields on ir_attachment")
|
||||
cr.execute(
|
||||
"""
|
||||
ALTER TABLE ir_attachment
|
||||
ADD COLUMN fs_storage_id INTEGER;
|
||||
ALTER TABLE ir_attachment
|
||||
ADD FOREIGN KEY (fs_storage_id) REFERENCES fs_storage(id);
|
||||
"""
|
||||
)
|
||||
cr.execute(
|
||||
"""
|
||||
ALTER TABLE ir_attachment
|
||||
ADD COLUMN fs_url VARCHAR;
|
||||
"""
|
||||
)
|
||||
cr.execute(
|
||||
"""
|
||||
ALTER TABLE ir_attachment
|
||||
ADD COLUMN fs_storage_code VARCHAR;
|
||||
"""
|
||||
)
|
||||
_logger.info("Columns added on ir_attachment")
|
||||
Loading…
Add table
Add a link
Reference in a new issue