diff options
Diffstat (limited to 'addons/web')
| -rw-r--r-- | addons/web/models/ir_http.py | 12 | ||||
| -rw-r--r-- | addons/web/views/webclient_templates.xml | 61 |
2 files changed, 63 insertions, 10 deletions
diff --git a/addons/web/models/ir_http.py b/addons/web/models/ir_http.py index 872c330ea64..7ae119c02d3 100644 --- a/addons/web/models/ir_http.py +++ b/addons/web/models/ir_http.py @@ -3,7 +3,7 @@ import hashlib import json -from odoo import models +from odoo import api, models from odoo.http import request from odoo.tools import ustr @@ -64,6 +64,16 @@ class Http(models.AbstractModel): }, } + @api.model + def get_frontend_session_info(self): + return { + 'is_admin': self.env.user._is_admin(), + 'is_system': self.env.user._is_system(), + 'is_website_user': self.env.user._is_public(), + 'user_id': self.env.user.id, + 'is_frontend': True, + } + def get_currencies(self): Currency = request.env['res.currency'] currencies = Currency.search([]).read(['symbol', 'position', 'decimal_places']) diff --git a/addons/web/views/webclient_templates.xml b/addons/web/views/webclient_templates.xml index d175360a2da..1bcd6280dab 100644 --- a/addons/web/views/webclient_templates.xml +++ b/addons/web/views/webclient_templates.xml @@ -382,19 +382,62 @@ </html> </template> + <template id="web.frontend_layout" name="Frontend Layout" inherit_id="web.layout" primary="True"> + <xpath expr="//head/link[last()]" position="after"> + <t t-call-assets="web.assets_common" t-js="false"/> + <t t-call-assets="web.assets_frontend" t-js="false"/> + </xpath> + <xpath expr="//head/script" position="after"> + <script type="text/javascript"> + odoo.session_info = <t t-raw="json.dumps(request.env['ir.http'].get_frontend_session_info())"/>; + </script> + <t t-call-assets="web.assets_common" t-css="false"/> + <t t-call-assets="web.assets_frontend" t-css="false"/> + </xpath> + <xpath expr="//t[@t-raw='0']" position="replace"> + <div id="wrapwrap" t-attf-class="#{pageName or ''}"> + <header t-if="not no_header" id="top" data-anchor="true"> + <img class="img-responsive d-block mx-auto" + t-attf-src="/web/binary/company_logo" + alt="Logo"/> + </header> + <main> + <t t-raw="0"/> + </main> + <footer t-if="not no_footer" id="bottom" data-anchor="true" class="bg-light o_footer"> + <div id="footer"/> + <div class="o_footer_copyright"> + <div class="container py-3"> + <div class="row"> + <div class="col-sm text-center text-sm-left text-muted"> + <span>Copyright &copy;</span> <span t-field="res_company.name" itemprop="name">Company name</span> + </div> + <div class="col-sm text-center text-sm-right"> + <t t-call="web.brand_promotion"/> + </div> + </div> + </div> + </div> + </footer> + </div> + </xpath> + </template> + + <template id="brand_promotion" name="Brand Promotion"> + <div class="o_brand_promotion"> + Powered by <a target="_blank" href="http://www.odoo.com?utm_source=db&utm_medium=portal">Odoo</a> + </div> + </template> + <template id="web.login_layout" name="Login Layout"> - <t t-call="web.layout"> + <t t-call="web.frontend_layout"> <t t-set="html_data" t-value="{'style': 'height: 100%;'}"/> - <t t-set="head"> - <t t-call-assets="web.assets_common" t-js="false"/> - <t t-call-assets="web.assets_frontend" t-js="false"/> - <t t-call-assets="web.assets_common" t-css="false"/> - <t t-call-assets="web.assets_frontend" t-css="false"/> - </t> <t t-set="body_classname" t-value="'bg-100'"/> + <t t-set="no_header" t-value="True"/> + <t t-set="no_footer" t-value="True"/> - <div class="container mb-5 pb-5"> - <div t-attf-class="card border-0 mx-auto mt-5 bg-100 {{login_card_classes}} o_database_list" style="max-width: 300px;"> + <div class="container py-5"> + <div t-attf-class="card border-0 mx-auto bg-100 {{login_card_classes}} o_database_list" style="max-width: 300px;"> <div class="card-body"> <div t-attf-class="text-center pb-3 border-bottom {{'mb-3' if form_small else 'mb-4'}}"> <img t-attf-src="/web/binary/company_logo{{ '?dbname='+db if db else '' }}" alt="Logo" style="max-height:120px; max-width: 100%; width:auto"/> |
