当前位置: 首页 > news >正文

【零散技术】5分钟完成Odoo18 登陆页面全自定义

序言:时间是我们最宝贵的财富,珍惜手上的每个时分

        从最初的tinyERP到Open ERP,再由OpenERP到Odoo,虽然UI已经过了多次大改,Odoo登录界面依旧丑陋,同时还有各种Odoo版权信息,对于定制项目而言是不友好的。

        今天以Odoo18为例,我们来做一个简单的即插即用的修改。

话不多说,直接上代码

新建文件:views/login_template.xml:

<?xml version="1.0" encoding="utf-8"?>
<odoo><template id="login_layout" inherit_id="web.login_layout" name="web Login Inherit"><xpath expr="//*[@class='text-center small mt-4 pt-3 border-top']"position="attributes"><attribute name="style">display:none</attribute></xpath><xpath expr="//*[@t-attf-class='card border-0 mx-auto bg-100 {{login_card_classes}} o_database_list']"position="attributes"><attribute name="style">max-width: 500px;margin-top:4rem; opacity: 0.8;</attribute></xpath></template><template id="ro_login"><t t-call="web.login_layout"><style>#wrapwrap{<!--                background-color:#1c7bd4 !important;-->background-image:url(/模块名称/static/src/login.png);"}</style><form t-attf-class="oe_login_form" role="form" t-attf-action="/web/login"method="post" onsubmit="this.action = '/web/login' + location.hash"><input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/><div class="mb-3 field-login"><label for="login" class="form-label d-flex justify-content-between">用户名</label><input type="text" placeholder="用户名" name="login" t-att-value="login" id="login"class="form-control" required="required" autocapitalize="off" autocomplete="username"/></div><div class="mb-3"><label for="password" class="form-label d-flex justify-content-between">密码</label><input type="password" placeholder="密码" name="password" id="password" class="form-control"required="required" autocomplete="current-password"t-att-autofocus="'autofocus' if login else None" maxlength="4096"/></div><p class="alert alert-danger" t-if="error" role="alert"><t t-esc="error"/></p><p class="alert alert-success" t-if="message" role="status"><t t-esc="message"/></p><div class="oe_login_buttons text-center gap-1 d-grid mb-1 pt-3"><button type="submit" class="btn btn-primary">登录</button></div></form></t></template></odoo>

引入视图:__manifiest__.py

''''data': ['views/login_template.xml',],
'''

新建 static/src文件夹,放入 login.png,此为背景图片,自己选素材即可。

在模块中做如上几步,即大功告成。

相关文章:

  • Spring Bean 生命周期:注册、初始化、注入及后置操作执行顺序
  • Go同步原语与数据竞争:原子操作(atomic)
  • 架构下的最终瓶颈:数据库如何破局?
  • java设计模式[1]之设计模式概览
  • java33
  • 23 - HaLoAttention模块
  • 从事算法工作对算法刷题量的需求
  • 从代码学习深度学习 - 子词嵌入 PyTorch版
  • JUC核心解析系列(三)——并发容器深度解析
  • acm模式stringstream
  • Windows平台进程加速方案研究:以网盘下载优化为例
  • Relin梦中门——第二章——感官
  • 带中断计数器的UART接收中断程序 (8259@400H/402H)
  • FreeRTOS定时器
  • Element Plus 去除下拉菜单周黑边
  • Ant Design 版本演进详解:从 1.x 到 5.x 的发展历程
  • docker安装mysql数据库及简单使用
  • 自恢复式保险丝如何实现自恢复?
  • 走线宽度对高频插入损耗的影响
  • Blender——建构、粒子、灯光、动画
  • 网站 被攻击_主业篡改 被黑了 织梦做的站/百度自动优化
  • 嘉兴网站制作公司/网站建设公司网站
  • 网站建设什么软件好/关键词大全
  • 草金加工东莞网站建设/设计素材网站
  • 文登市城乡建设局网站/电商软文范例100字
  • 网站seo靠谱/色盲眼镜