[ADD] page attribute to views

This can be used to distinguish template views expected to be
available as web pages, and thus directly linkable. By opposition to
non-web views and template sections (reusables).

bzr revid: xmo@openerp.com-20130821121206-ebxsxrmyogcv7pnv
This commit is contained in:
Xavier Morel 2013-08-21 14:12:06 +02:00
parent 4a4169ba75
commit d8bf3892f3
3 changed files with 14 additions and 3 deletions

View File

@ -82,9 +82,11 @@ class view(osv.osv):
'groups_id': fields.many2many('res.groups', 'ir_ui_view_group_rel', 'view_id', 'group_id',
string='Groups', help="If this field is empty, the view applies to all users. Otherwise, the view applies to the users of those groups only."),
'model_ids': fields.one2many('ir.model.data', 'res_id', auto_join=True),
'page': fields.boolean("Whether this view is a web page template (complete)"),
}
_defaults = {
'priority': 16,
'page': False,
}
_order = "priority,name"

View File

@ -204,11 +204,18 @@
<rng:define name="template">
<rng:element name="template">
<rng:optional><rng:attribute name="id"/></rng:optional>
<rng:optional><rng:attribute name="t-name"/></rng:optional>
<rng:optional><rng:attribute name="name"/></rng:optional>
<rng:optional><rng:attribute name="inherit_id"/></rng:optional>
<rng:optional><rng:attribute name="inherit_option_id"/></rng:optional>
<rng:optional><rng:attribute name="forcecreate"/></rng:optional>
<rng:optional><rng:attribute name="context"/></rng:optional>
<rng:optional>
<rng:attribute name="page"><rng:value>True</rng:value></rng:attribute>
</rng:optional>
<rng:zeroOrMore>
<rng:choice>
<rng:attribute>
<rng:anyName/>
</rng:attribute>
<rng:text/>
<rng:ref name="any"/>
</rng:choice>

View File

@ -872,6 +872,8 @@ form: module.record_id""" % (xml_id,)
if el.get(key):
record.append(etree.fromstring('<field name="%s" ref="%s"/>' % (key, el.get(key))))
el.attrib.pop(key, None)
if el.get('page'):
record.append(etree.Element('field', name="page", eval="True"))
return self._tag_record(cr, record, data_node)
def id_get(self, cr, id_str):