2019独角兽企业重金招聘Python工程师标准>>>
win10的开发环境,2个礼拜前发现odoo10.0 登陆后无法加载菜单和内容,打开chrome控制台发现报以下错误。
Refused to execute script from 'http://localhost:8069/web/content/384-9a2c984/web.assets_common.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
web:1 Refused to execute script from 'http://localhost:8069/web/content/390-83280c2/web.assets_backend.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
web:1 Refused to execute script from 'http://localhost:8069/web/content/391-9f0b00b/web_editor.summernote.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
web:1 Refused to execute script from 'http://localhost:8069/web/content/392-fce7d77/web_editor.assets_editor.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
当时在找不到任何解决方案,
在Odoo官方论坛找到一个帖子,问题描述和我一样,但是按照别人回答,是无法解决问题的。
无果,只好在deepin下干了2个礼拜的工作。期间相关odoo群也问过,无人能解决
昨晚终于下定决心解决此问题,经过几个小时搜索引擎查找,终于在一个帖子找到了资料,解决方案如下:
查询数据库找到后台返回的文件类型text/plain
select * from ir_attachment where mimetype ='text/plain' and datas_fname like '%.js';
把mimetype字段的值:text/plain 改为 text/javascript
然后清除chrome的缓存,久违的odoo页面终于显现,可以在Windows下开心的干活了。同时不忘借花献佛,在Odoo官方论坛回复了问题。
补充,发现每次修改文件,重启odoo服务,都会出现此问题,找了UPDATE语句处理
UPDATE ir_attachment SET mimetype = 'text/javascript' WHERE mimetype ='text/plain' and datas_fname like '%.js';
-----------另外非开发环境的解决方案()-----------
# 直接使用“在路径中替换”功能,在'\addons'和 '\odoo'中,将text/plain改为text/javascript
-----------2017-25-28-----------
http://localhost:8069/web?debug=assets
改成assets模式可以有效解决
决定写一个 odoo 在windows下面的一个开发控制面板