Tuesday, 12 July 2016

Odoo Menu : Hiding ,Deleting, replacing name or showing the menu only in debug mode


To delete the menu
<delete model="ir.ui.menu" id="mail.menu_contacts"/>

To replace name of menu id
<record model="ir.ui.menu" id="hr.menu_hr_root">
<field name="name">HR</field>      
</record>

To show the menu only in debug mode by using 'base.group_no_one' 
<record model="ir.ui.menu" id="hr.menu_hr_root">
<field name="name">Employees</field>
<field eval="[(6,0,[ref('base.group_no_one')])]" name="groups_id"/>
</record>
Note : 
  eval="[(6,0,[ref('base.group_no_one')])]"

It will replace all existing group ids with 'base.group_no_one' id in applied in 'hr.menu_hr_root' menu id .

<record model="ir.ui.menu" id="hr.menu_hr_root">
<field name="groups_id" eval="[(4,ref('base.group_no_one'))]"/>
</record>
   eval="[(4,ref('base.group_no_one'))]"
It will update given group id with existing group ids applied in 'hr.menu_hr_root' menu.



Monday, 27 June 2016

Odoo 9 : Adding background image for login screen

1) create a new xml file as 'webclient_templates.xml' an add below code.
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
 
        <template id="login_layout_inherited_your_module" inherit_id="web.login_layout">
            <xpath expr="." position="inside">
                <link rel="stylesheet" href="/your_module/static/src/css/your_css_file.css"/>
            </xpath>
        </template>

        </data>
</openerp>

2) Create a new .css file your  module and add below code.

.container {
background-image: url('/your_module/static/src/img/your_image.jpg');
}

Odoo 9 : Replace 'Powered by Odoo' Footer string

1) Create a new xml file as 'webclient_templates.xml' and add below code.

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
       
        <!-- Purpose : Replace Odoo string and link as per your company's link and name - Added by Nivas M -->
        <template id="inherited_web_menu_secondary" inherit_id="web.menu_secondary">
        <xpath expr="//div[@class='oe_footer']" position="replace">
           <div class="oe_footer">
              Powered by <a href="http://yourcompany.com/" target="_blank"><span>Your Company</span></a>
           </div>
            </xpath>
        </template>

</data>
</openerp>




Friday, 24 June 2016

Odoo 9 Database Backup and Restore

Taking DB backup:

1)      Go to database Manager
2)      Click on backup link in your database
3)      Enter your master password (if you have set Master password).Backup format as: zip (includes filestore)
4)      Extract the downloaded zip file
5)      Your db is now in sql format as dump.sql

Restoring sql format db in new db

1) Create a new db in local with owner selection
2) Go to location
                C:\Program Files\PostgreSQL\9.2\bin -> select psql.exe file
                2.1) (menu)File -> Open commant prompt 


3) Go to comment prompt  and type

   psql.exe  –U db_user db_name < “your sql file location”

4) Enter db_user password
                It data will be start to move from sql format db to your created db.
5) Finally.You can check your data in created db now.





Wednesday, 16 March 2016

Odoo 9 : Customizing Login page design.

1) Create a new xml file as webclient_templates.xml
2) Add the below code.
<!-- Redesigning odoo 9 login form - Nivas M  -->
<template id="web.login" name="Login">
<style>
.form_wrapper{
background:#fff;
border:1px solid #ddd;
margin:0 auto;
width:350px;
-moz-box-shadow:1px 1px 7px #ccc;
-webkit-box-shadow:1px 1px 7px #ccc;
box-shadow:5px 5px 7px #ccc;

font-family: "Times New Roman", Georgia, Serif;
}
.form_wrapper h3{
padding:20px 30px 20px 30px;
background-color:#28517A;
color:#fff;
font-size:25px;
border-bottom:1px solid #ddd;
}
.form_wrapper h1{
padding:20px 30px 50px 30px;
background-color:#28517A;
color:#fff;
font-size:25px;
border-bottom:1px solid #ddd;
}
.form_wrapper form{
background:#fff;
}
.form_wrapper label, h1{
display:block;
padding:0px 30px 0px;
margin:10px 0px 0px 0px;

font-family: "Times New Roman", Georgia, Serif;;
font-weight: lighter;
font-size: 16px;
}
.form_wrapper input[type="text"],
.form_wrapper input[type="password"]{
border: solid 1px #E5E5E5;
background: #FFFFFF;
margin: 5px 30px 0px 30px;
padding: 9px;
display:block;
font-size:16px;
width:76%;
background:
-webkit-gradient(
linear,
left top,
left 25,
from(#FFFFFF),
color-stop(4%, #EEEEEE),
to(#FFFFFF)
);
background:
-moz-linear-gradient(
top,
#FFFFFF,
#EEEEEE 1px,
#FFFFFF 25px
);
-moz-box-shadow: 0px 0px 8px #f0f0f0;
-webkit-box-shadow: 0px 0px 8px #f0f0f0;
box-shadow: 0px 0px 8px #f0f0f0;
}
.form_wrapper input[type="text"]:focus,
.form_wrapper input[type="password"]:focus{
background:#feffef;
}

.form_wrapper button[type="submit"] {
background: #e3e3e3;
border: 1px solid #ccc;
color: #333;
font-family: "Trebuchet MS", "Myriad Pro", sans-serif;
font-size: 14px;
font-weight: bold;
text-align: center;
width: 150px;
       height: 35px;
cursor:pointer;
float:right;
       margin: 0px 80px 30px 0px;
text-shadow: 0px 1px 0px #fff;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: 0px 0px 2px #fff inset;
-webkit-box-shadow: 0px 0px 2px #fff inset;
box-shadow: 0px 0px 2px #fff inset;
}
.form_wrapper button[type="submit"]:hover {
background: #d9d9d9;
-moz-box-shadow: 0px 0px 2px #eaeaea inset;
-webkit-box-shadow: 0px 0px 2px #eaeaea inset;
box-shadow: 0px 0px 2px #eaeaea inset;
color: #222;

}
</style>
            <t t-call="web.login_layout">

                <form class="form_wrapper" 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()"/>

<h3>Login</h3>

                    <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">Username</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"/>
               <h1><button type="submit" >Login</button> </h1>

                </form>
            </t>
        </template>
<!-- End -->

Output :

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.