Odoo Help


IndentationError: unexpected indent?

Praveen S
on 7/26/13, 4:18 PM 10,598 views

hi , i am new to openerp as well as python their exists an error while installing. please help me. my code was here.

from openerp.osv import osv, fields

class mymod(osv.Model):
    _name = 'mymod.mymod'    
    _columns = {
               'name': fields.char('Name', size = 100), 
               'dob': fields.date('Date of birth'),
               'father_name': fields.char('Father Name', size = 100),
               'state': fields.selection([
                                    ('lost','Lost')], 'Stage', readonly=True),

    def mymod_new(self, cr, uid, ids):
         self.write(cr, uid, ids, {'state': 'new'})
         return True

    def mymod_assigned(self, cr, uid, ids):
         self.write(cr, uid, ids, {'state': 'assigned'})
         return True

    def mymod_negotiation(self, cr, uid, ids):
         self.write(cr, uid, ids, {'state': 'negotiation'})
         return True

    def mymod_won(self, cr, uid, ids):
         self.write(cr, uid, ids, {'state': 'won'})
         return True

    def mymod_lost(self, cr, uid, ids):
         self.write(cr, uid, ids, {'state': 'lost'})
         return True    


i am studying the workflow example pls help me.. The error is IndentationError: unexpected indent

try removing all tabs and indenting again...

on 7/26/13, 5:28 PM

Ray Carnes

--Ray Carnes--
| 9 7 9
Keyport, United States
--Ray Carnes--

Senior ERP Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0 and 11.0.

Completed Odoo Functional and Technical Training.

Functional Areas:

  • CRM/Sales

  • Inventory

  • Manufacturing

  • Accounting

  • Purchasing

Major Skills:

  • Business Process Reengineering

  • Efficiency Consulting

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
On 7/27/13, 6:05 PM

Rules for Python Indentation:

  • Either always use tab or always use spaces - never mix the two.
  • Even better would be to never use tabs, they don't always survive copy/paste.
  • Use 4 spaces per indentation level (or 2, or 8) and always be consistent.

The problem with your source (assuming you don't have any tabs - although what you posted doesn't have tabs - your source may since the tabs could have been lost during copy/paste):

You have an indentation level of 4 spaces beneath class and 5 spaces beneath def. Remove a space from the indentation below all of the function definitions.

thanks Ray Carnes

Praveen S
on 7/28/13, 12:23 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 7/26/13, 4:18 PM
Seen: 10598 times
Last updated: 3/16/15, 8:10 AM