Odoo 15 POS模块自定义收据时出现Internal Server Error(500)求助
Odoo 15 POS收据自定义开发出现500内部服务器错误
问题情况
使用Odoo 15版本对POS模块收据进行自定义开发时,触发Internal Server Error(500),核心报错为文件找不到。
相关代码
manifest.py
... "license": "OPL-1", "depends": [ 'base', 'point_of_sale', ], 'assets': { 'web.assets_qweb': [ 'static/src/xml/OrderReceipt.xml', # 'views/OrderReceipt.xml', ], ...
OrderReceipt.xml
<?xml version="1.0" encoding="UTF-8"?> <templates id="template" xml:space="preserve"> <t t-extend="OrderReceipt"> <t t-jquery=".pos-receipt .pos-receipt-contact" t-operation='append'> <t t-if='receipt.client'> <div style="font-weight:bold;">Customer:<t t-esc='receipt.client'/></div> </t> <p>Success !</p> </t> </t> </templates>
错误日志
FileNotFoundError: File not found: static/src/xml/OrderReceipt.xml - - - 2022-07-28 05:41:09,068 342410 INFO newestDB07021 werkzeug: 192.168.0.61 - - [28/Jul/2022 05:41:09] "GET /favicon.ico HTTP/1.1" 404 - 127 0.074 0.189 2022-07-28 05:41:50,952 342410 INFO newestDB07021 werkzeug: 192.168.0.61 - - [28/Jul/2022 05:41:50] "POST /longpolling/poll HTTP/1.1" 200 - 13 0.025 50.159 2022-07-28 05:41:52,030 342410 INFO newestDB07021 werkzeug: 192.168.0.61 - - [28/Jul/2022 05:41:52] "POST /longpolling/poll HTTP/1.1" 200 - 9 0.017 50.024 2022-07-28 05:41:55,264 342410 INFO newestDB07021 odoo.addons.base.models.ir_cron: Starting job `payment: post-process transactions`. 2022-07-28 05:41:55,270 342410 INFO newestDB07021 odoo.addons.base.models.ir_cron: Job `payment: post-process transactions` done.
解决步骤
- 校验文件路径:确认自定义模块目录下存在
static/src/xml/OrderReceipt.xml,目录结构必须与manifest中配置的路径完全一致。如果实际文件在views目录下,要么修改manifest中的路径为views/OrderReceipt.xml并取消注释,要么将文件移动到static/src/xml目录中。 - 检查大小写匹配:Linux环境下Odoo对路径大小写敏感,确保文件名、目录名的大小写与manifest中的配置完全一致,比如不要将
OrderReceipt.xml写成orderreceipt.xml。 - 升级模块:修改manifest或调整文件位置后,必须在Odoo后台升级该自定义模块,确保系统加载最新的资源配置。
- 清理缓存:若升级后仍报错,可尝试清理Odoo的缓存(设置 -> 技术 -> 缓存管理 -> 清除缓存),再重新加载页面。
内容的提问来源于stack exchange,提问作者user1261494
相关产品推荐
相关产品推荐

