Odoo Help

0

IndentationError: unexpected indent?

By
Praveen S
on 7/26/13, 4:18 PM 7,149 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--
16339
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

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

Completed Odoo Functional and Technical Training.

Major Skills:

  • 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

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

Register

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)

Stats

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