changes
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
{
|
||||
"name": "Fusion Theme Switcher",
|
||||
"version": "19.0.1.0.1",
|
||||
"version": "19.0.1.1.0",
|
||||
"category": "Productivity",
|
||||
"summary": "Backend header toggle for Odoo Enterprise light and dark mode.",
|
||||
"description": """
|
||||
|
||||
1
fusion_theme_switcher/models/__init__.py
Normal file
1
fusion_theme_switcher/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import res_users_settings
|
||||
33
fusion_theme_switcher/models/res_users_settings.py
Normal file
33
fusion_theme_switcher/models/res_users_settings.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2026 Nexa Systems Inc.
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
"""Coerce a missing color_scheme to the default on create/write.
|
||||
|
||||
`web_enterprise` declares `color_scheme` as required with default 'system',
|
||||
and the DB column is NOT NULL. It also adds a radio widget for
|
||||
`res.users.color_scheme` (a related field) to the user form. For a brand-new
|
||||
user the underlying `res.users.settings` record doesn't exist yet, so the
|
||||
widget loads with no value and submitting the form propagates
|
||||
`color_scheme=False` into the eventual settings create/write — which trips the
|
||||
NOT NULL constraint and surfaces as "Missing required value for the field
|
||||
'Color Scheme'".
|
||||
|
||||
Treat a falsy color_scheme as 'omit' so the field's own default applies.
|
||||
"""
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class ResUsersSettings(models.Model):
|
||||
_inherit = "res.users.settings"
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
if "color_scheme" in vals and not vals["color_scheme"]:
|
||||
vals["color_scheme"] = "system"
|
||||
return super().create(vals_list)
|
||||
|
||||
def write(self, vals):
|
||||
if "color_scheme" in vals and not vals["color_scheme"]:
|
||||
vals = {**vals, "color_scheme": "system"}
|
||||
return super().write(vals)
|
||||
Reference in New Issue
Block a user