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

【零散技术】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,此为背景图片,自己选素材即可。

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

http://www.xdnf.cn/news/14110.html

相关文章:

  • 50天50个小项目 (Vue3 + Tailwindcss V4) ✨ | AnimatedNavigation(动态导航)
  • 打破长推理迷思:基于困惑度的自适应推理如何实现效率与精度的双赢
  • python训练营day52
  • 【YOLO 系列】基于YOLO的车载摄像头道路标志和车辆目标检测识别系统【python源码+Pyqt5界面+数据集+训练代码】
  • 茶文化部分答案
  • 在docker中部署ollama
  • Linux下成功编译CPU版Caffe的保姆级教程(基于Anaconda Python3.8 包含完整可用Makefile.config文件)
  • Redis集群模式之Redis Cluster(2)
  • 掌握C#枚举:从交通灯看懂状态管理
  • 项目拓展-Jol分析本地对象or缓存的内存占用
  • pdb/sdf转pdbqt错误、pdbqt小分子文件对接蛋白质dock分数为0
  • 基于Python学习《Head First设计模式》第十四章 剩下的模式
  • 算法C实现--第16章习题集-外部查找
  • 从事算法工作对算法刷题量的需求
  • 0到1案例演示 vue + axios 请求 springboot 的 restful 风格接口(前后端分离+跨域问题)
  • k8s的开篇学习和安装
  • 1.0 前言(Python系列教程)
  • 深入解析JVM字节码执行引擎
  • 基于GNU Radio Companion搭建的FM信号及数字通信
  • python: wxpython 4.2 开发一个邮件客户端,能编写邮件,发送邮件及附件
  • Ubuntu中Chromium无法使用Fcitx输入中文的问题
  • PySpark 使用pyarrow指定版本
  • cesium入门
  • 剖析电商搜索要点并基于Es+Redis模拟电商搜索行为
  • Flink task、Operator 和 UDF 之间的关系
  • 【系统分析师】2009年真题:案例分析-答案及详解
  • HQL 优化:从低效到高效的蜕变之旅
  • Python 函数
  • UE5反射系统分析(一)generated.h
  • 日本生活:日语语言学校-日语作文-沟通无国界(1)-题目:假装写日记