Initial commit: OCA Technical packages (595 packages)

This commit is contained in:
Ernad Husremovic 2025-08-29 15:43:03 +02:00
commit 2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions

View file

@ -0,0 +1,4 @@
# © 2022 Florian Kantelberg - initOS GmbH
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import ir_http, res_users

View file

@ -0,0 +1,23 @@
# © 2022 Florian Kantelberg - initOS GmbH
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
from odoo.http import request
class IrHttp(models.AbstractModel):
_inherit = "ir.http"
@classmethod
def _set_color_scheme(cls, response):
scheme = request.httprequest.cookies.get("color_scheme")
user = request.env.user
user_scheme = "dark" if getattr(user, "dark_mode", None) else "light"
device_dependent = getattr(user, "dark_mode_device_dependent", None)
if (not device_dependent) and scheme != user_scheme:
response.set_cookie("color_scheme", user_scheme)
@classmethod
def _post_dispatch(cls, response):
cls._set_color_scheme(response)
return super()._post_dispatch(response)

View file

@ -0,0 +1,26 @@
# © 2022 Florian Kantelberg - initOS GmbH
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ResUsers(models.Model):
_inherit = "res.users"
dark_mode = fields.Boolean()
dark_mode_device_dependent = fields.Boolean("Device Dependent Dark Mode")
@property
def SELF_READABLE_FIELDS(self):
return super().SELF_READABLE_FIELDS + [
"dark_mode_device_dependent",
"dark_mode",
]
@property
def SELF_WRITEABLE_FIELDS(self):
return super().SELF_WRITEABLE_FIELDS + [
"dark_mode_device_dependent",
"dark_mode",
]