[IMP] attachment_azure: Add support for DB operations

This commit is contained in:
Hiren Pattani-SerpentCS
2021-08-12 11:10:52 -05:00
committed by Maxime Chambreuil
co-authored by Maxime Chambreuil
parent 4b61f43f85
commit 1c25f1c1a8
6 changed files with 120 additions and 13 deletions
+16
View File
@@ -1,4 +1,20 @@
# Copyright 2016-2019 Camptocamp SA
# Copyright 2021 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
import os
from . import models
from . import controllers
from odoo import api, SUPERUSER_ID
def _post_init_hook(cr, registry):
# create the S3 bucket after module installation
if os.environ.get("AZURE_STORAGE_CONNECTION_STRING", False):
env = api.Environment(cr, SUPERUSER_ID, {})
env["ir.attachment"]._get_azure_container()
env["ir.config_parameter"].create(
{"key": "ir_attachment.location", "value": "azure"}
)
env["ir.attachment"].force_storage()