同步机床类型对象

This commit is contained in:
qihao.gong@jikimo.com
2023-06-07 10:49:55 +08:00
parent 7dfab63a89
commit 46c57162d7
84 changed files with 3388 additions and 4 deletions

View File

@@ -0,0 +1 @@
from . import web_environment_ribbon_backend

View File

@@ -0,0 +1,36 @@
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models
class WebEnvironmentRibbonBackend(models.AbstractModel):
_name = "web.environment.ribbon.backend"
_description = "Web Environment Ribbon Backend"
@api.model
def _prepare_ribbon_format_vals(self):
return {"db_name": self.env.cr.dbname}
@api.model
def _prepare_ribbon_name(self):
name_tmpl = self.env["ir.config_parameter"].sudo().get_param("ribbon.name")
vals = self._prepare_ribbon_format_vals()
return name_tmpl and name_tmpl.format(**vals) or name_tmpl
@api.model
def get_environment_ribbon(self):
"""
This method returns the ribbon data from ir config parameters
:return: dictionary
"""
ir_config_model = self.env["ir.config_parameter"]
name = self._prepare_ribbon_name()
return {
"name": name,
"color": ir_config_model.sudo().get_param("ribbon.color"),
"background_color": ir_config_model.sudo().get_param(
"ribbon.background.color"
),
}