开始debug,在URL添加debug与相应的参数参照如下:
http://127.0.0.1:8069/web?debug=1#action=120&cids=1&menu_id=94&model=amos.device&view_type=list
激活开发者模式:debug=1
激活开发者模式(使用资源测试):debug=assets,tests
取消开发者模式:debug=0
在开发者工具内也可以加载演示数据
主要用于界面信息查看,调试等
激活开发者后可以很容易通过浏览器调度你的js
# -*- coding: utf-8 -*-
from dtcloud import api, fields, models, tools
class SqlModel(models.Model):
_name = 'sql.model'
_description = "Sql Model"
#使用此字段后不会自动创建表
_auto = False
field_one = fields.Char(readonly=True)
field_two = fields.Char(readonly=True)
field_three = fields.Integer(readonly=True)
#重写init方法
@api.model_cr
def init(self):
tools.drop_view_if_exists(self.env.cr, self._table)
#必须要查询id
sql = """create or replace view %s as (select 1 as id, 2 as field_one, 3 as field_two , 4 as field_three)""" % self._table
self.env.cr.execute(sql)