[ADD] ir.model : list of modules in which the object is defined
[ADD] ir.model.fields : list of modules in which the field is defined [IMP] ir.model : aligned field form view with ir.model.fields [ADD] ir.model : list of views [ADD] ir.model : report "Model Overview" bzr revid: jba@openerp.com-20110105140708-qrby7d6trhjw7vs5
This commit is contained in:
parent
fc20503f95
commit
0849ba9d6f
|
@ -43,6 +43,7 @@
|
|||
'ir/wizard/wizard_menu_view.xml',
|
||||
'ir/ir.xml',
|
||||
'ir/workflow/workflow_view.xml',
|
||||
'ir/report/ir_report.xml',
|
||||
'module/module_view.xml',
|
||||
'module/module_data.xml',
|
||||
'module/module_report.xml',
|
||||
|
|
|
@ -967,6 +967,7 @@
|
|||
<field name="model"/>
|
||||
<field name="osv_memory"/>
|
||||
<field name="state"/>
|
||||
<field name="modules" colspan="4"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Fields">
|
||||
|
@ -981,29 +982,26 @@
|
|||
<field name="state"/>
|
||||
</tree>
|
||||
<form string="Fields Description">
|
||||
<group colspan="4" col="4">
|
||||
<field name="name" select="1"/>
|
||||
<field colspan="4" name="field_description" select="2"/>
|
||||
</group>
|
||||
<field name="name" select="1"/>
|
||||
<field name="field_description" select="2"/>
|
||||
<field name="state"/>
|
||||
|
||||
<separator string="Properties" colspan="4"/>
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Field Type" colspan="2"/>
|
||||
<field name="ttype" select="2"/>
|
||||
<field name="relation" attrs="{'required': [('ttype','in',['many2one','one2many','many2many'])],'readonly': [('ttype','!=','one2many'), ('ttype','!=','many2one'), ('ttype','!=','many2many')]}"/>
|
||||
<field name="relation_field" attrs="{'required': [('ttype','=','one2many')], 'readonly': [('ttype','!=','one2many')]}"/>
|
||||
<field name="selection" attrs="{'required': [('ttype','in',['selection','reference'])], 'readonly': [('ttype','not in',['selection','reference'])]}"/>
|
||||
<field name="size" attrs="{'required': [('ttype','in',['char','reference'])], 'readonly': [('ttype','not in',['char','reference'])]}"/>
|
||||
<field name="state"/>
|
||||
<field name="domain" attrs="{'readonly': [('relation','=','')]}"/>
|
||||
</group>
|
||||
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Properties" colspan="2"/>
|
||||
<field name="required" select="2"/>
|
||||
<field name="readonly" select="2"/>
|
||||
<field name="select_level"/>
|
||||
<field name="translate"/>
|
||||
<field name="on_delete" attrs="{'readonly': [('ttype','!=','many2one')]}"/>
|
||||
<field name="modules"/>
|
||||
</group>
|
||||
<separator string="Groups" colspan="4"/>
|
||||
<field name="groups" colspan="4" nolabel="1"/>
|
||||
|
@ -1032,6 +1030,9 @@
|
|||
<page string="Notes">
|
||||
<field colspan="4" name="info" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Views">
|
||||
<field colspan="4" name="view_ids" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
|
@ -1094,7 +1095,7 @@
|
|||
<field name="model_id" attrs="{'readonly': [('state','!=', 'manual')]}"/>
|
||||
<field name="field_description"/>
|
||||
<field name="state"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Properties">
|
||||
<group colspan="2" col="2">
|
||||
|
@ -1113,6 +1114,7 @@
|
|||
<field name="select_level"/>
|
||||
<field name="translate"/>
|
||||
<field name="on_delete" attrs="{'readonly': [('ttype','!=','many2one')]}"/>
|
||||
<field name="modules"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Security">
|
||||
|
|
|
@ -63,6 +63,18 @@ class ir_model(osv.osv):
|
|||
is_osv_mem = self._is_osv_memory(cr, uid, all_model_ids, 'osv_memory', arg=None, context=context)
|
||||
return [('id', 'in', [id for id in is_osv_mem if bool(is_osv_mem[id]) == value])]
|
||||
|
||||
def _in_modules(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = osv.osv.get_xml_ids(self, cr, uid, ids)
|
||||
for k,v in res.iteritems():
|
||||
res[k]=', '.join(map(lambda x: x.split('.')[0],v))
|
||||
return res
|
||||
|
||||
def _view_ids(self, cr, uid, ids, field_name, arg, context=None):
|
||||
models=self.browse(cr,uid,ids)
|
||||
res={}
|
||||
for model in models:
|
||||
res[model.id]=self.pool.get("ir.ui.view").search(cr, uid, [('model', '=', model.name)])
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Object Name', size=64, translate=True, required=True),
|
||||
|
@ -73,7 +85,9 @@ class ir_model(osv.osv):
|
|||
'access_ids': fields.one2many('ir.model.access', 'model_id', 'Access'),
|
||||
'osv_memory': fields.function(_is_osv_memory, method=True, string='In-memory model', type='boolean',
|
||||
fnct_search=_search_osv_memory,
|
||||
help="Indicates whether this object model lives in memory only, i.e. is not persisted (osv.osv_memory)")
|
||||
help="Indicates whether this object model lives in memory only, i.e. is not persisted (osv.osv_memory)"),
|
||||
'modules': fields.function(_in_modules, method=True, type='char', size=128, string='In modules', help='List of modules in which the object is defined'),
|
||||
'view_ids': fields.function(_view_ids, method=True, type='one2many', obj='ir.ui.view', string='Views'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
@ -150,6 +164,13 @@ ir_model()
|
|||
class ir_model_fields(osv.osv):
|
||||
_name = 'ir.model.fields'
|
||||
_description = "Fields"
|
||||
|
||||
def _in_modules(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = osv.osv.get_xml_ids(self, cr, uid, ids)
|
||||
for k,v in res.iteritems():
|
||||
res[k]=', '.join(map(lambda x: x.split('.')[0],v))
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', required=True, size=64, select=1),
|
||||
'model': fields.char('Object Name', size=64, required=True, select=1),
|
||||
|
@ -170,6 +191,7 @@ class ir_model_fields(osv.osv):
|
|||
'groups': fields.many2many('res.groups', 'ir_model_fields_group_rel', 'field_id', 'group_id', 'Groups'),
|
||||
'view_load': fields.boolean('View Auto-Load'),
|
||||
'selectable': fields.boolean('Selectable'),
|
||||
'modules': fields.function(_in_modules, method=True, type='char', size=128, string='In modules', help='List of modules in which the field is defined'),
|
||||
}
|
||||
_rec_name='field_description'
|
||||
_defaults = {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<report id="report_ir_model_overview"
|
||||
string="Model Overview"
|
||||
model="ir.model"
|
||||
name="ir.model.overview"
|
||||
report_type="sxw"
|
||||
file="base/ir/report/modeloverview.sxw"
|
||||
header="False"
|
||||
/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue