Thursday, 19 November 2015

Changing the Page title and image in Odoo9



Changing the Page title and images in Odoo9

1) web\static\src\js\web_client.js
Line No : 50 Change the Odoo string into YOUR_TITLE
Before: this.set('title_part', {"zopenerp": "Odoo"});
After: this.set('title_part', {"zopenerp": "Your_Title"});

Line No : 171 Change the " - " symbol into " | "
Before: tmp = tmp ? tmp + " - " + str : str;
After :tmp = tmp ? tmp + " | " + str : str;

2) Create a file in 'views' folder in your module and named as 'webclient_templates.xml'
Add the following lines,

Note : In this code you can add your page title image too in the following line "href="/your_module/static/src/img/favicon.ico""
<link rel="shortcut icon" href="/your_module/static/src/img/favicon.ico" type="image/x-icon"/><!-- Changed the page title image -->
It will also remove the 'Powered By' string in login page.If you want to redesign the login page you can do it in 'web.login_layout'

Your_Module/Views/webclient_templates.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Changing 'Odoo' title string into 'Your_Title' -->

<template id="web.layout" name="Web layout">&lt;!DOCTYPE html&gt;
<html style="height: 100%">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Your_Title</title><!-- Changed the title -->
<link rel="shortcut icon" href="/your_module/static/src/img/favicon.ico" type="image/x-icon"/><!-- Changed the page title image -->
<link rel="stylesheet" href="/web/static/src/css/full.css" />
<t t-raw="head or ''"/>
</head>
<body t-att-class="body_classname">
<t t-raw="0"/>
</body>
</html>
</template>

<template id="web.login_layout" name="Login Layout">
<t t-call="web.layout">
<t t-set="head">
<link rel="stylesheet" href="/web/static/lib/bootstrap/css/bootstrap.css" />
<link rel="stylesheet" href="/web/static/lib/fontawesome/css/font-awesome.css" />
<script src="/web/static/lib/jquery/jquery.js" type="text/javascript" />
</t>
<t t-set="body_classname" t-value="'container'" />
<div class="row">
<div class="col-md-6 col-md-offset-3 o_database_list">
<!-- Add space here -->
<br />
<br />
<br />
<!--End -->
<div class="text-center">
<img t-attf-src="/web/binary/company_logo{{ '?dbname='+db if db else '' }}" />
</div>
<t t-raw="0" />
<div class="text-center" t-if="not disable_footer">
<t t-if="not disable_database_manager">
<a class="" href="/web/database/manager"></a>
</t>
<a href="www.odoo.com" target="_blank">
<span></span>
</a>
<!-- <a href="www.odoo.com" target="_blank">Powered by <span>BES</span></a> -->
</div>

</div>
</div>
</t>
</template>

<template id="web.login" name="Login">
<t t-call="web.login_layout">
<form class="oe_login_form" role="form"
t-attf-action="/web/login{{ '?debug' if debug else '' }}" method="post"
onsubmit="this.action = this.action + location.hash">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />

<div class="form-group field-db" t-if="databases and len(databases) &gt; 1">
<label for="db" class="control-label">Database</label>
<div class="input-group">
<input type="text" name="db" t-att-value="request.db" id="db"
class="form-control" required="required" readonly="readonly" />
<span class="input-group-btn">
<a href="/web/database/selector" class="btn btn-default">
Select
<i class="fa fa-database"></i>
</a>
</span>
</div>
</div>

<div class="form-group field-login">
<label for="login" class="control-label">Email</label>
<input type="text" name="login" t-att-value="login" id="login"
class="form-control" required="required" autofocus="autofocus" />
</div>

<div class="form-group field-password">
<label for="password" class="control-label">Password</label>
<input type="password" name="password" id="password" class="form-control"
required="required" t-att-autofocus="'autofocus' if login else None" />
</div>

<p class="alert alert-danger" t-if="error">
<t t-esc="error" />
</p>
<p class="alert alert-success" t-if="message">
<t t-esc="message" />
</p>

<input type="hidden" name="redirect" t-att-value="redirect" />
<div class="clearfix oe_login_buttons">
<button type="submit" class="btn btn-primary">Log in</button>
</div>

</form>
</t>
</template>
<template id="web.menu_secondary">
            <a class="oe_logo" t-att-href="'/web/?debug' if debug else '/web'">
                <span class="oe_logo_edit">Edit Company data</span>
                <img src='/web/binary/company_logo'/>
            </a>
            <div class="oe_secondary_menus_container">
                <t t-foreach="menu_data['children']" t-as="menu">
                    <div style="display: none" class="oe_secondary_menu" t-att-data-menu-parent="menu['id']">
                        <t t-foreach="menu['children']" t-as="menu">
                            <div class="oe_secondary_menu_section">                              
                                <t t-if="menu['children']"><t t-esc="menu['name']"/></t>
                                <t t-if="not menu['children']"><t t-call="web.menu_link"/></t>
                            </div>
                            <t t-call="web.menu_secondary_submenu"/>
                        </t>
                    </div>
                </t>
            </div>
            <div class="oe_footer">
                Powered by <a href="http://www.wbmoore.com/" target="_blank"><span>MOORE</span></a>
            </div>
        </template>

</data>
</openerp>

Wednesday, 18 March 2015

To change default header and footer in odoo 8 pdf report

1)Setting/Technical/User Interface/Views/
2)Search word - external. you will receive three views as
   1)external_layout
   2)external_layout_footer
   3)external_layout_header
   4)You can change the default header and footer content of your company here
   5)Ex: To remove the default header line(Great Product for Great People)
1)Go to external_layout_header view
2)Hide the line no 8 as follows,
 <!-- <div class="col-xs-9 text-right" style="margin-top:20px;" t-field="company.rml_header1"/> -->
3)Now That particular line will be hidden in your repot header.