[init/add] generic backend theme
This commit is contained in:
4
muk_web_theme-19/muk_web_appsbar/models/__init__.py
Normal file
4
muk_web_theme-19/muk_web_appsbar/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from . import ir_http
|
||||
from . import res_users
|
||||
from . import res_company
|
||||
from . import res_config_settings
|
||||
19
muk_web_theme-19/muk_web_appsbar/models/ir_http.py
Normal file
19
muk_web_theme-19/muk_web_appsbar/models/ir_http.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from odoo import models
|
||||
|
||||
|
||||
class IrHttp(models.AbstractModel):
|
||||
|
||||
_inherit = "ir.http"
|
||||
|
||||
#----------------------------------------------------------
|
||||
# Functions
|
||||
#----------------------------------------------------------
|
||||
|
||||
def session_info(self):
|
||||
result = super().session_info()
|
||||
if self.env.user._is_internal():
|
||||
for company in self.env.user.company_ids.with_context(bin_size=True):
|
||||
result['user_companies']['allowed_companies'][company.id].update({
|
||||
'has_appsbar_image': bool(company.appbar_image),
|
||||
})
|
||||
return result
|
||||
15
muk_web_theme-19/muk_web_appsbar/models/res_company.py
Normal file
15
muk_web_theme-19/muk_web_appsbar/models/res_company.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
|
||||
_inherit = 'res.company'
|
||||
|
||||
#----------------------------------------------------------
|
||||
# Fields
|
||||
#----------------------------------------------------------
|
||||
|
||||
appbar_image = fields.Binary(
|
||||
string='Apps Menu Footer Image',
|
||||
attachment=True
|
||||
)
|
||||
@@ -0,0 +1,15 @@
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
#----------------------------------------------------------
|
||||
# Fields
|
||||
#----------------------------------------------------------
|
||||
|
||||
appbar_image = fields.Binary(
|
||||
related='company_id.appbar_image',
|
||||
readonly=False
|
||||
)
|
||||
37
muk_web_theme-19/muk_web_appsbar/models/res_users.py
Normal file
37
muk_web_theme-19/muk_web_appsbar/models/res_users.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class ResUsers(models.Model):
|
||||
|
||||
_inherit = 'res.users'
|
||||
|
||||
#----------------------------------------------------------
|
||||
# Properties
|
||||
#----------------------------------------------------------
|
||||
|
||||
@property
|
||||
def SELF_READABLE_FIELDS(self):
|
||||
return super().SELF_READABLE_FIELDS + [
|
||||
'sidebar_type',
|
||||
]
|
||||
|
||||
@property
|
||||
def SELF_WRITEABLE_FIELDS(self):
|
||||
return super().SELF_WRITEABLE_FIELDS + [
|
||||
'sidebar_type',
|
||||
]
|
||||
|
||||
#----------------------------------------------------------
|
||||
# Fields
|
||||
#----------------------------------------------------------
|
||||
|
||||
sidebar_type = fields.Selection(
|
||||
selection=[
|
||||
('invisible', 'Invisible'),
|
||||
('small', 'Small'),
|
||||
('large', 'Large')
|
||||
],
|
||||
string="Sidebar Type",
|
||||
default='large',
|
||||
required=True,
|
||||
)
|
||||
Reference in New Issue
Block a user