select REPLACE(model.model, '.', '_') as "表名",
(select mot.value
from ir_translation mot
where mot.res_id = model.id
and mot.name = 'ir.model,name'
and mot.state = 'translated'
and mot.lang = 'zh_CN'
and mot.value is not null
limit 1) as "表描述",
field.name as "字段名称",
coalesce((select fit.value
from ir_translation fit
where 1 = 1
and name = 'ir.model.fields,field_description'
and fit.res_id = field.id
and fit.state = 'translated'
and fit.lang = 'zh_CN'
and fit.type = 'model'
and fit.value is not null
limit 1),field.field_description) as "字段描述",
case
when field.ttype in ('many2one', 'integer') then 'int4'
when field.ttype in ('char', 'selection') then 'varchar'
when field.ttype = 'date' then 'timestamp'
when field.ttype = 'boolean' then 'bool'
when field.ttype = 'float' then 'float8'
else field.ttype
end 类型,
case
when field.required = True then '是'
else '否'
end 必输,
REPLACE(relation, '.', '_') 关联表,
case
when field.ttype = 'many2one' then 'FK'
when field.name = 'id' then 'PK'
end 备注
from ir_model model
join ir_model_fields field on model.id = field.model_id
where 1 = 1
and field.name not in ('create_date', 'create_uid', 'write_date', 'write_uid', '__last_update','field_show')
and field.ttype not in ('many2many', 'one2many')
and model.model like 'product.product'
and model.model not like '%report%'
and model.model not like '%wizard%'
and model.model not like 'hrp.base%'
order by model.model, case when field.name = 'id' then 1 else 2 end
版权归属:
EinTao
许可协议:
本文使用《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》协议授权
评论区