[IMP] renamed some stuff for clarity
This commit is contained in:
parent
80c7b6defc
commit
d67161b649
|
@ -212,7 +212,11 @@ class Website(openerp.addons.web.controllers.main.Home):
|
|||
return True
|
||||
|
||||
@http.route('/website/customize_template_get', type='json', auth='user', website=True)
|
||||
def customize_template_get(self, xml_id, optional=True):
|
||||
def customize_template_get(self, xml_id, full=False):
|
||||
""" Lists the templates customizing ``xml_id``. By default, only
|
||||
returns optional templates (which can be toggled on and off), if
|
||||
``full=True`` returns all templates customizing ``xml_id``
|
||||
"""
|
||||
imd = request.registry['ir.model.data']
|
||||
view_model, view_theme_id = imd.get_object_reference(
|
||||
request.cr, request.uid, 'website', 'theme')
|
||||
|
@ -227,7 +231,7 @@ class Website(openerp.addons.web.controllers.main.Home):
|
|||
for v in views:
|
||||
if not user_groups.issuperset(v.groups_id):
|
||||
continue
|
||||
if v.inherit_option_id and v.inherit_option_id.id != view_theme_id or not optional:
|
||||
if full or v.inherit_option_id and v.inherit_option_id.id != view_theme_id:
|
||||
if v.inherit_option_id.id not in done:
|
||||
result.append({
|
||||
'name': v.inherit_option_id.name,
|
||||
|
@ -244,7 +248,7 @@ class Website(openerp.addons.web.controllers.main.Home):
|
|||
'xml_id': v.xml_id,
|
||||
'inherit_id': v.inherit_id.id,
|
||||
'header': False,
|
||||
'active': (v.inherit_id.id == v.inherit_option_id.id) or (not optional and v.inherit_id.id)
|
||||
'active': (v.inherit_id.id == v.inherit_option_id.id) or (full and v.inherit_id.id)
|
||||
})
|
||||
return result
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ class view(osv.osv):
|
|||
|
||||
* the view itself
|
||||
* all views inheriting from it, enabled or not
|
||||
- but not the optional children of a non-enabled child
|
||||
* all views called from it (via t-call)
|
||||
"""
|
||||
try:
|
||||
|
@ -65,16 +66,16 @@ class view(osv.osv):
|
|||
if called_view not in result:
|
||||
result += self._views_get(cr, uid, called_view, options=options, context=context)
|
||||
|
||||
todo = set(view.inherit_children_ids)
|
||||
extensions = set(view.inherit_children_ids)
|
||||
if options:
|
||||
todo.update(view.inherited_option_ids)
|
||||
extensions.update(view.inherited_option_ids)
|
||||
|
||||
# Keep options in a deterministic order regardless of their applicability
|
||||
for child_view in sorted(todo, key=lambda v: v.id):
|
||||
for extension in sorted(extensions, key=lambda v: v.id):
|
||||
for r in self._views_get(
|
||||
cr, uid, child_view,
|
||||
cr, uid, extension,
|
||||
# only return optional grandchildren if this child is enabled
|
||||
options=bool(child_view.inherit_id),
|
||||
options=bool(extension.inherit_id),
|
||||
context=context, root=False):
|
||||
if r not in result:
|
||||
result.append(r)
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
var viewId = $(document.documentElement).data('view-xmlid');
|
||||
openerp.jsonRpc('/website/customize_template_get', 'call', {
|
||||
'xml_id': viewId,
|
||||
'optional': false,
|
||||
'full': true,
|
||||
}).then(function (views) {
|
||||
self.loadViews.call(self, views);
|
||||
self.open.call(self);
|
||||
|
|
Loading…
Reference in New Issue