how to change the theme In odoo10

You add CSS path to your module

<?xml version="1.0" encoding="UTF-8"?>
        <template id="assets_backend" name="Open Mobile Assets" inherit_id="web.assets_backend">
          <xpath expr=".">
                 <link rel='stylesheet' href="/ep_generic_web_customization/static/src/css/client_customizations.css"/>
<strong>Your CSS</strong> 


.navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:hover, .navbar-inverse .navbar-nav > .active > a:focus {
    color: #fcfcfc;
    background-color: #080808;

.navbar-inverse .navbar-nav > li > a {
    color: #e8df96;

Calling a python method (server action) directly from menuitem or button

Here is an example:

Server Action

<record id="action_make_testing" model="ir.actions.server">

<field name="name">Make Testing</field>

<field name="condition">True</field>

<field name="type">ir.actions.server</field>

<field name="model_id" ref="model_res_partner" />

<field name="state">code</field>

<field name="code">self.test_act(cr, uid, context.get('active_ids', []), context=context)</field>



<menuitem id='menu_testing' name='Testing' sequence="100" parent="base.menu_base_config" action="action_make_testing"/>

Python code to run : Method name = test_act

class res_partner(osv.osv):

     _inherit = 'res.partner'

     def test_act(self,cr,uid,ids,context={}):

         return True 

How to send email with existing template -odoo

def send_by_email(self, cr, uid,ids, context=None):
mail_mail = self.pool.get('mail.mail')
email_template_obj = self.pool.get('email.template')
template_ids =, uid, [('model_id.model', '=','account.invoice')], context=context)
ir_attachment = self.pool.get('ir.attachment')
if template_ids:

values = email_template_obj.generate_email(cr, uid, template_ids[0], 2, context=context)
if not values.get('email_from'):
raise osv.except_osv(_('Warning!'), _("Sender email is missing or empty after template rendering. Specify one to deliver your message"))
values['recipient_ids'] = [(4, pid) for pid in values.get('partner_ids', list())]
attachment_ids = values.pop('attachment_ids', [])
attachments = values.pop('attachments', [])
msg_id = mail_mail.create(cr, uid, values, context=context)
mail = mail_mail.browse(cr, uid, msg_id, context=context)

for attachment in attachments:
attachment_data = {
'name': attachment[0],
'datas_fname': attachment[0],
'datas': attachment[1],
'res_model': 'mail.message',
context = dict(context)
context.pop('default_type', None)
attachment_ids.append(ir_attachment.create(cr, uid, attachment_data, context=context))
if attachment_ids:
values['attachment_ids'] = [(6, 0, attachment_ids)]
mail_mail.write(cr, uid, msg_id, {'attachment_ids': [(6, 0, attachment_ids)]}, context=context)

#if msg_id:
#mail_mail.send(cr, uid, [msg_id], context=context)

return True

Customize odoo notification mail from Name

class mail_message(osv.Model):
    def _get_default_from(self, cr, uid, context=None):
        this = self.pool.get('res.users').browse(cr, SUPERUSER_ID, uid, context=context)
        if this.alias_name and this.alias_domain:
            return formataddr(('odoo - ', '%s@%s' % (this.alias_name, this.alias_domain)))
            return formataddr(('odoo - ',
        raise osv.except_osv(_('Invalid Action!'), _("Unable to send email, please configure the sender's email address or alias."))

How to Create a Network Share Via Samba – odoo

1). sudo apt-get install samba
2). vim /etc/samba/smb.conf
add below line to bottom
  comment = odoo share
  path = /opt/odoo
  browsable = yes
  guest ok = yes
  read only = no
  create mask = 0777
  force user = odoo
  directory mask = 0777
3) sudo systemctl restart smbd.service nmbd.service
4) Access through \\\odoo10-share

Install ODOO 10 on UBUNTU 16.04 LTS


Update apt source list

sudo apt-get update


Install Updates

sudo apt-get upgrade


Install Python Dependencies for Odoo

sudo apt-get install python-dateutil python-docutils python-feedparser python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi poppler-utils python-pip python-pypdf python-passlib python-decorator gcc python-dev mc bzr python-setuptools python-markupsafe python-reportlab-accel python-zsi python-yaml python-argparse python-openssl python-egenix-mxdatetime python-usb python-serial lptools make python-pydot python-psutil python-paramiko poppler-utils python-pdftools antiword python-requests python-xlsxwriter python-suds python-psycogreen python-ofxparse python-gevent


Odoo Web Dependencies

sudo apt-get install -y npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g less less-plugin-clean-css


Install PostgreSQL

sudo apt-get install python-software-properties
sudo vim /etc/apt/sources.list.d/pgdg.list

add a line for the repository

deb xenial-pgdg main

then proceed with below commands

sudo wget –quiet -O – | sudo apt-key add –

sudo apt-get update
sudo apt-get install postgresql-9.6


Create Database user for Odoo

sudo su postgres
createuser -s odoo
createuser -s ubuntu_user_name


Create Odoo user and group

sudo adduser --system --home=/opt/odoo --group odoo


Install Gdatacd /opt/odoo

sudo wget

sudo tar zxvf gdata-2.0.18.tar.gz
sudo chown -R odoo: gdata-2.0.18
sudo -s
cd gdata-2.0.18/
python install


Odoo 10 Download from GitHub

cd /opt/odoo
sudo wget
sudo unzip
sudo chown -R odoo: odoo-10.0

sudo mv odoo/ odoo-10.0/
sudo chown -R odoo: odoo-10.0


Create Odoo Log File

sudo mkdir /var/log/odoo
sudo chown -R odoo:root /var/log/odoo


Edit Odoo configuration file

sudo cp /opt/odoo/odoo-10.0/debian/odoo.conf /etc/odoo.conf
sudo chown odoo: /etc/odoo.conf
sudo vim /etc/odoo.conf

#Copy and paste below content in config file
; This is the password that allows database operations:
; admin_passwd = PASSWORD
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /opt/odoo/odoo-10.0/addons
;Log Settings
logfile = /var/log/odoo/odoo.log
log_level = error


sudo wget

Install the package using command

sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb

Copy wkhtmltoimage to /usr/bin location from /usr/local/bin by using below command

sudo cp /usr/local/bin/wkhtmltoimage /usr/bin/wkhtmltoimage

Copy wkhtmltopdf to /usr/bin location from /usr/local/bin by using below command

sudo cp /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf


Now Start Odoo Server

cd /opt/odoo/odoo-10.0

STEP 14 (Automated Start)

sudo vim /etc/systemd/system/odoo10.service

# Ubuntu/Debian convention:
ExecStart=/opt/odoo/odoo-10.0/odoo-bin -c /etc/odoo.conf

sudo mkdir /var/lib/odoo
sudo chown odoo:root /var/lib/odoo -R

sudo systemctl enable odoo.service (Enable service)

sudo systemctl start odoo10.service (starts service)
sudo systemctl stop odoo10.service (stops service)
sudo systemctl restart odoo10.service (restarts Service)
sudo systemctl status odoo10.service (status of service)
sudo systemctl enable odoo10.service (starts service at boot)
sudo systemctl disable odoo10.service (disables service at boot)


Go to web browser to access Odoo 10