Odoo Help

Welcome!

This community 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.

0

IndentationError: unexpected indent?

By
Praveen S
on 7/26/13, 4:18 PM 6,574 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([
                                    ('new','New'),
                                    ('assigned','Assigned'),
                                    ('negotiation','Negotiation'),
                                    ('won','Won'),
                                    ('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    

mymod()

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

try removing all tabs and indenting again...

Gustavo
on 7/26/13, 5:28 PM
0

Ray Carnes

--Ray Carnes--
15717
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

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. 

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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