return request.registry['ir.http']._handle_exception(e, 404)
return request.website.render(page, values)
+ @website.route('/website/reset_templates', type='http', auth='user', methods=['POST'])
+ def reset_template(self, templates, redirect='/'):
+ templates = request.httprequest.form.getlist('templates')
+ modules_to_update = []
+ for temp_id in templates:
+ view = request.registry['ir.ui.view'].browse(request.cr, request.uid, int(temp_id), context=request.context)
+ view.model_data_id.write({
+ 'noupdate': False
+ })
+ if view.model_data_id.module not in modules_to_update:
+ modules_to_update.append(view.model_data_id.module)
+ module_obj = request.registry['ir.module.module']
+ module_ids = module_obj.search(request.cr, request.uid, [('name', 'in', modules_to_update)], context=request.context)
+ module_obj.button_immediate_upgrade(request.cr, request.uid, module_ids, context=request.context)
+ return request.redirect(redirect)
+
@website.route('/website/customize_template_toggle', type='json', auth='user')
def customize_template_set(self, view_id):
view_obj = request.registry.get("ir.ui.view")
)
if code == 500:
logger.error("500 Internal Server Error:\n\n%s", values['traceback'])
+ if values['qweb_template']:
+ view = request.registry.get("ir.ui.view")
+ views = view._views_get(request.cr, request.uid, values['qweb_template'], request.context)
+ to_reset = [view for view in views if view.model_data_id.noupdate == True]
+ values['views'] = to_reset
elif code == 403:
logger.warn("403 Forbidden:\n\n%s", values['traceback'])
-@charset "utf-8";
/* THIS CSS FILE IS FOR WEBSITE THEMING CUSTOMIZATION ONLY
*
* css for editor buttons, openerp widget included in the website and other
span[data-oe-type="monetary"] {
white-space: nowrap;
}
+
+.oe_template_fallback {
+ -webkit-column-count: 3;
+ -moz-column-count: 3;
+ -ms-column-count: 3;
+ -o-column-count: 3;
+ column-count: 3;
+}
+
+.bs-callout {
+ margin: 20px 0;
+ padding: 20px;
+ border-left: 3px solid #eeeeee;
+}
+
+.bs-callout h4 {
+ margin-top: 0;
+ margin-bottom: 5px;
+}
+
+.bs-callout p:last-child {
+ margin-bottom: 0;
+}
+
+.bs-callout-danger {
+ background-color: #fdf7f7;
+ border-color: #eed3d7;
+}
+
+.bs-callout-danger h4 {
+ color: #b94a48;
+}
+
+.bs-callout-warning {
+ background-color: #faf8f0;
+ border-color: #faebcc;
+}
+
+.bs-callout-warning h4 {
+ color: #8a6d3b;
+}
+
+.bs-callout-info {
+ background-color: #f4f8fa;
+ border-color: #bce8f1;
+}
+
+.bs-callout-info h4 {
+ color: #34789a;
+}
margin-right: 1px
span[data-oe-type="monetary"]
- white-space: nowrap
\ No newline at end of file
+ white-space: nowrap
+
+.oe_template_fallback
+ @include column-count(3)
+
+// ---- Callouts from bootstrap doc ---- {{{
+.bs-callout
+ margin: 20px 0
+ padding: 20px
+ border-left: 3px solid #eee
+.bs-callout h4
+ margin-top: 0
+ margin-bottom: 5px
+.bs-callout p:last-child
+ margin-bottom: 0
+
+.bs-callout-danger
+ background-color: #fdf7f7
+ border-color: #eed3d7
+.bs-callout-danger h4
+ color: #b94a48
+.bs-callout-warning
+ background-color: #faf8f0
+ border-color: #faebcc
+.bs-callout-warning h4
+ color: #8a6d3b
+.bs-callout-info
+ background-color: #f4f8fa
+ border-color: #bce8f1
+.bs-callout-info h4
+ color: #34789a
+// }}}
</div>
</template>
+<template id="403">
+ <t t-call="website.layout">
+ <div id="wrap">
+ <div class="container">
+ <h1 class="mt32">403: Forbidden</h1>
+ <p>The page you were looking for could not be authorized.</p>
+ <p>Maybe you were looking for one of these popular pages ?</p>
+ <ul>
+ <li><a href="/">Homepage</a></li>
+ <li><a href="/page/website.contactus/">Contact Us</a></li>
+ </ul>
+ </div>
+ <t t-if="editable or request.debug">
+ <t t-call="website.http_error_debug"/>
+ </t>
+ </div>
+ </t>
+</template>
+
<template id="404">
<t t-call="website.layout">
<div id="wrap">
</template>
<template id="500">
- <t t-call="website.http_error"/>
-</template>
+ <!-- This template should not use any variable except those provided by website.ir_http._handle_exception -->
+ <html>
+ <head>
+ <title t-esc="status_message">Internal Server Error</title>
+ <link rel='stylesheet' href='/web/static/lib/fontawesome/css/font-awesome.css'/>
+ <link rel='stylesheet' href='/web/static/lib/bootstrap/css/bootstrap.css'/>
+ <link rel='stylesheet' href='/website/static/src/css/website.css'/>
+ <script type="text/javascript" src="/web/static/lib/jquery/jquery.js"></script>
+ <script type="text/javascript" src="/web/static/lib/bootstrap/js/bootstrap.js"></script>
+ </head>
+ <body>
+ <div id="wrapwrap">
+ <div class="navbar navbar-default navbar-static-top">
+ <div class="container">
+ <div class="collapse navbar-collapse navbar-top-collapse">
+ <ul class="nav navbar-nav">
+ <li><a href="/">Home</a></li>
+ <li><a href="javascript: window.history.back()">Back</a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ <div class="mb32">
+ <div class="oe_structure">
+ <h1 class="container mt32"><t t-esc="status_code"/>: <t t-esc="status_message"/></h1>
+ </div>
-<template id="403">
- <t t-call="website.layout">
- <div id="wrap">
- <div class="container">
- <h1 class="mt32">403: Forbidden</h1>
- <p>
- The page you were looking for could not be
- authorized.
- </p>
- <p>
- Maybe you were looking for one of these
- popular pages ?
- </p>
- <ul>
- <li><a href="/">Homepage</a></li>
- <li><a href="/page/website.contactus/">Contact Us</a></li>
- </ul>
- </div>
- <t t-if="editable or request.debug">
- <t t-call="website.http_error_debug"/>
- </t>
- </div>
- </t>
+ <div class="container" t-if="views">
+ <div class="bs-callout bs-callout-danger" t-if="qweb_template and editable">
+ <h4>Template fallback</h4>
+ <p>An error occured while rendering the template <code t-esc="qweb_template"/>.</p>
+ <p>If this error is caused by a change of yours in the templates, you have the possibility to reset one or more templates to their <strong>factory settings</strong>.</p>
+ <form action="/website/reset_templates" method="post">
+ <ul class="oe_template_fallback">
+ <li t-foreach="views" t-as="view">
+ <label>
+ <input type="checkbox" name="templates" t-att-value="view.id" t-att-checked="'checked' if view_first else None"/>
+ <t t-esc="view.name"/>
+ </label>
+ </li>
+ </ul>
+ <input type="hidden" name="redirect" t-att-value="request.httprequest.path"/>
+ <input type="submit" value="Reset selected templates" onclick="this.disabled = true"/>
+ </form>
+ </div>
+ </div>
+
+ <t t-if="editable or request.debug">
+ <t t-call="website.http_error_debug"/>
+ </t>
+ </div>
+ </div>
+ </body>
+ </html>
</template>
<template id="robots">