在odoo加载过程中,title处会显示odoo以及odoo标签图片,
所以我们可以进行修改,将其公司化
1. 修改无公司名称时显示字样
<title t-esc="title or 'Odoo'"/>
<!--路径:addons/web/views/webclient_templates.xml,(第14行)
这当无 title 值时,显示Odoo字样,
我们可以修改为公司名称等其他信息
-->
<title t-esc="title or '测试哈哈哈'"/>
2. 修改加载过程的图标
1.替换 android-192x192.png 297行
在web模块下,搜索 android-192x192.png 将其替换为自己想要的图标图片等
替换 favicon.ico
在web模块下,搜索 favicon.ico 将其替换为自己想要的图标图片等
路径:addons\web\static\src\public\database_manager.qweb.html,(第5行),
addons/web/views/webclient_templates.xml(第15行)
3. 修改Odoo title字样
py 设置
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
app_system_name = fields.Char('系统名称')
@api.model
def get_values(self):
res = super(ResConfigSettings, self).get_values()
ir_config = self.env['ir.config_parameter'].sudo()
app_system_name = ir_config.get_param('app_system_name', default='Odoo')
res.update(app_system_name=app_system_name, )
return res
def set_values(self):
res = super(ResConfigSettings, self).set_values()
ir_config = self.env['ir.config_parameter'].sudo()
ir_config.set_param("app_system_name", self.app_system_name or "")
return res
class IrHttp(models.AbstractModel):
_inherit = 'ir.http'
def session_info(self):
result = super(IrHttp, self).session_info()
config_parameter = request.env['ir.config_parameter'].sudo()
result['app_system_name'] = config_parameter.get_param('app_system_name', 'odooApp')
return result
js 设置
/** @odoo-module **/
import { WebClient } from "@web/webclient/webclient";
import { patch } from "@web/core/utils/patch";
import { session } from "@web/session";
patch(WebClient.prototype, "partner_management.WebClient", {
setup() {
this._super.apply(this, arguments);
const app_system_name = session.app_system_name || 'odooApp';
this.title.setParts({ zopenerp: app_system_name }); // zopenerp is easy to grep
}
});
xml设置
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_app_theme_config_settings" model="ir.ui.view">
<field name="name">标题设置</field>
<field name="model">res.config.settings</field>
<field name="priority">20</field>
<field name="arch" type="xml">
<form string="odooApp Customize Settings" class="oe_form_configuration">
<header>
<button string="应用" type="object" name="execute" class="oe_highlight"/>
<button string="取消" type="object" name="cancel" class="oe_link" special="cancel"/>
</header>
<group string="设置系统">
<label for="app_system_name"/>
<div>
<field name="app_system_name"/>
</div>
</group>
</form>
</field>
</record>
<record id="action_app_theme_config" model="ir.actions.act_window">
<field name="name">系统名称设置</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.config.settings</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_app_theme_config_settings"/>
<field name="target">inline</field>
</record>
<menuitem name="系统名称设置" id="menu_app_theme_config" parent="base.menu_administration"
sequence="100" groups="base.group_system" action="action_app_theme_config"/>
</data>
</odoo>