Odoo中文网|Odoo实施培训

 找回密码
 立即注册
搜索
热搜: Odoo OpenERP 实施
查看: 8615|回复: 0
打印 上一主题 下一主题

odoo 从debug_sql的的sql语句得出一些结论(个人看法)

[复制链接]

119

主题

119

帖子

566

积分

高级会员

Rank: 4

积分
566
跳转到指定楼层
楼主
发表于 2016-10-19 22:04:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
1.模块的加载顺序(推测,有所根据模块的翻译的加载顺序就跟sequence有关,系统中多有的页面的显示都是要经翻译的,所以足见 ,翻译的顺序也就是 模块的加载的顺序)

2016-01-20 07:28:03,029 15178 DEBUG test openerp.sql_db: query: SELECT "ir_module_module".id FROM "ir_module_module" WHERE (("ir_module_module"."state" = 'installed')  AND  ("ir_module_module"."name" != 'web')) ORDER BY "ir_module_module"."sequence" ,"ir_module_module"."name"  
2016-01-20 07:28:03,032 15178 DEBUG test openerp.sql_db: query:  SELECT "ir_module_module"."name","ir_module_module"."id" FROM "ir_module_module"
                        WHERE "ir_module_module".id IN (69, 25, 4, 143, 220, 251, 234, 241, 236, 8, 165, 20, 136, 179, 105, 131, 36, 204, 145, 192, 63, 198, 230, 108, 32, 148, 73, 113, 368, 34, 200, 10, 100, 249, 76, 229, 256, 235, 104, 232, 3, 92, 221, 244, 222, 160, 46, 52, 65, 19, 250, 28, 191, 228, 166, 112, 189, 111, 172, 155, 31, 362, 373, 37, 146, 51, 181, 144, 359, 374, 39, 370, 364, 367, 349, 344, 353)  ORDER BY "ir_module_module"."sequence" ,"ir_module_module"."name"  
这是让oe的log文件的log输出级别设成debug_sql 后最先执行的两句sql 。
从sql中我们可以看到。ORDER BY "ir_module_module"."sequence" ,"ir_module_module"."name"   获取所有安装的模块并通过 sequence进行排序 。接下来就是根据这些顺序获取模块的信息。

2.继承视图的加载顺序(sql 只是体现之一,在实践中也验证这个是对的。)
从这些sql中可以发现 ORDER BY "ir_ui_view"."priority" ,"ir_ui_view"."name"    对于xml中视图的加载的顺序
priority  找到所有的视图再进行操作。

29:23,117 15178 DEBUG test openerp.sql_db: query: SELECT "ir_ui_view".id FROM "ir_ui_view" WHERE (((("ir_ui_view"."inherit_id" = 602)  AND  ("ir_ui_view"."model" = 'sale.order'))  AND  ("ir_ui_view"."mode" = 'extension'))  AND  ("ir_ui_view"."active" = true)) ORDER BY "ir_ui_view"."priority" ,"ir_ui_view"."name"  
2016-01-20 07:
29:23,121 15178 DEBUG test openerp.sql_db: query: SELECT "ir_ui_view".id FROM "ir_ui_view" WHERE (((("ir_ui_view"."inherit_id" = 744)  AND  ("ir_ui_view"."model" = 'sale.order'))  AND  ("ir_ui_view"."mode" = 'extension'))  AND  ("ir_ui_view"."active" = true)) ORDER BY "ir_ui_view"."priority" ,"ir_ui_view"."name"  
2016-01-20 07:
29:23,122 15178 DEBUG test openerp.sql_db: query: SELECT "ir_ui_view".id FROM "ir_ui_view" WHERE (((("ir_ui_view"."inherit_id" = 1014)  AND  ("ir_ui_view"."model" = 'sale.order'))  AND  ("ir_ui_view"."mode" = 'extension'))  AND  ("ir_ui_view"."active" = true)) ORDER BY "ir_ui_view"."priority" ,"ir_ui_view"."name"  
2016-01-20 07:
29:23,124 15178 DEBUG test openerp.sql_db: query: SELECT "ir_ui_view".id FROM "ir_ui_view" WHERE (((("ir_ui_view"."inherit_id" = 920)  AND  ("ir_ui_view"."model" = 'sale.order'))  AND  ("ir_ui_view"."mode" = 'extension'))  AND  ("ir_ui_view"."active" = true)) ORDER BY "ir_ui_view"."priority" ,"ir_ui_view"."name"  

3.翻译!!!不明白odoo对于翻译机制怎么实现的同学们,看看 sql 就明白了。。
是每次从数据库中取出来的,而且是每个词取一次,对数据库的压力也比较大。,,oe支持多语言,如果你们装了多种语言, 翻译页很多的情况下,每次的点击都是比较慢的。

SELECT value
                       FROM ir_translation
                       WHERE lang='en_US'
                        AND type in ('view')
                        AND src='404: Page not found!' AND res_id in (776) AND name='website'
2016-01-20 07:54:08,369 15178 DEBUG test openerp.sql_db: query: SELECT value
                       FROM ir_translation
                       WHERE lang='en_US'
                        AND type in ('view')
                        AND src='The page you were looking for could not be found; it is possible you have
                        typed the address incorrectly, but it has most probably been removed due
                        to the recent website reorganisation.' AND res_id in (776) AND name='website'
2016-01-20 07:54:08,370 15178 DEBUG test openerp.sql_db: query: SELECT value
                       FROM ir_translation
                       WHERE lang='en_US'
                        AND type in ('view')
                        AND src='Maybe you were looking for one of these popular pages ?' AND res_id in (776) AND name='website'
2016-01-20 07:54:08,374 15178 INFO ? werkzeug: 127.0.0.1 - - [20/Jan/2016 07:54:08] "GET /web_widget_x2many_2d_matrix/static/src/css/web_widget_x2many_2d_matrix.css HTTP/1.1" 200 -
2016-01-20 07:54:08,374 15178 DEBUG test openerp.sql_db: query: SELECT value
                       FROM ir_translation
                       WHERE lang='en_US'
                        AND type in ('view')
                        AND src='Homepage' AND res_id in (776) AND name='website'
2016-01-20 07:54:08,376 15178 INFO ? werkzeug: 127.0.0.1 - - [20/Jan/2016 07:54:08] "GET /web/static/lib/jquery/jquery.js HTTP/1.1" 200 -
2016-01-20 07:54:08,376 15178 DEBUG test openerp.sql_db: query: SELECT value
                       FROM ir_translation
                       WHERE lang='en_US'
                        AND type in ('view')
                        AND src='Contact Us' AND res_id in (776) AND name='website'


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|技术支持|开发手册|Odoo中文网-远鼎旗下odoo培训网站 ( 苏ICP备15039516号 )

GMT+8, 2024-4-26 15:43 , Processed in 0.010889 second(s), 10 queries , Xcache On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表