Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

OdooV13 unindent does not match any outer indentation level

Subscribe

Get notified when there's activity on this post

This question has been flagged
3 Replies
4368 Views
Avatar
Madara

iam getting this error in my custom module , coz of this iam unable to start my server

   __import__('odoo.addons.' + module_name)
  File "/odoo/odoo-server/addons/transfers/__init__.py", line 4, in <module>
    from . import transfers
File "/odoo/odoo-server/addons/transfers/transfers.py", line 22
    @api.model
             ^
IndentationError: unindent does not match any outer indentation level - - -



transfers.py:



# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import models, fields, api , _



class Transfers(models.Model):
     _name ="transfers.name"
     _inherit = ['mail.thread','mail.activity.mixin']
     _description ="Transfer Record"

     transfers_Name = fields.Char(string="Name", required = True)
     transfers_ISO = fields.Char(string="ISO")
     transfers_amount = fields.Integer("Amount")
     notes = fields.Text(string ="Notes")
     image = fields.Binary(string ="Image")
     name = fields.Char(string='Order Reference', required=True, copy=False, readonly=True, states={'draft': [('readonly', False)]}, index=True, default=lambda self: _('New'))



    @api.model
    def create(self, vals):
        if vals.get('name', _('New')) == _('New'):

             vals['name'] = self.env['ir.sequence'].next_by_code('transfer.order.sequence', sequence_date=seq_date) or _('New')

        result = super(Transfers, self).create(vals)
        return result


sequence.xml:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="1">

        <!-- Sequences for sale.order -->
        <record id="seq_transfers" model="ir.sequence">
            <field name="name">Transfer Order</field>
            <field name="code">transfer.order.sequence</field>
            <field name="prefix">T0</field>
            <field name="padding">5</field>
            <field name="company_id" eval="False"/>
        </record>

    </data>
</odoo>



manifest.py:

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

{
    'name': 'Transfers',
    'version': '1.0',
    'summary': 'Module for Money Transfer',
    'category': 'Extra Tools',
    'description':
    """
Transifex integration
=====================
This module will add a link to the Transifex project in the translation view.
The purpose of this module is to speed up translations of the main modules.

To work, Odoo uses Transifex configuration files `.tx/config` to detec the
project source. Custom modules will not be translated (as not published on
the main Transifex project).

The language the user tries to translate must be activated on the Transifex
project.
        """,
    'data': [
        'security/ir.model.access.csv' ,
        'data/sequence.xml' ,
        'transfers.xml',
       
    ],
    'depends': ['mail'],
    'installable':True,
    'application':True,
    'auto_install':False,
}



someone help iam a newbie to odoo13 development


0
Avatar
Discard
Sehrish

You have to read this: https://old.reddit.com/r/PythonForOdoo/

Avatar
Ashish Singh
Best Answer

Hi, Guna


Kindly update the below code, Actually all fields which you defined inside the models contains extra space due to this you are getting the "Indentation" issue.
class Transfers(models.Model):
 
_name ="transfers.name"
  _inherit = ['mail.thread','mail.activity.mixin']
  _description ="Transfer Record"

  transfers_Name = fields.Char(string="Name", required = True)
  transfers_ISO = fields.Char(string="ISO")
  transfers_amount = fields.Integer("Amount")
  notes = fields.Text(string ="Notes")
  image = fields.Binary(string ="Image")
  name = fields.Char(string='Order Reference', required=True, copy=False, readonly=True, states={'draft': [('readonly', False)]}, index=True, default=lambda self: _('New'))

@api.model
def create(self, vals):
if vals.get('name', _('New')) == _('New'):
  vals['name'] = self.env['ir.sequence'].next_by_code('transfer.order.sequence', sequence_date=seq_date) or _('New')
  result = super(Transfers, self).create(vals)
return result

Feel free to ask in case you have any confusion related to the above points.
You may get undefined "seq_date" key error. So please don't forget to define this field inside the create method.

Thanks,
Ashish Singh (Team Lead)
Webkul Software Private Limited

4
Avatar
Discard
Avatar
Urvisha
Best Answer

Hi
you did mistake on indentation. In most other programming languages, indentation is used only to help make the code look pretty. But in Python, it is required for indicating what block of code a statement belongs to.

please write code like this in .py file 

class Transfers(models.Model): _name ="transfers.name" _inherit = ['mail.thread','mail.activity.mixin'] _description ="Transfer Record" transfers_Name = fields.Char(string="Name", required = True) transfers_ISO = fields.Char(string="ISO") transfers_amount = fields.Integer("Amount") notes = fields.Text(string ="Notes") image = fields.Binary(string ="Image") name = fields.Char(string='Order Reference', required=True, copy=False,readonly=True, states={'draft': [('readonly', False)]}, index=True, default=lambda self: _('New')) @api.model def create(self, vals): if vals.get('name', _('New')) == _('New'): vals['name'] = self.env['ir.sequence'].next_by_code('transfer.order.sequence', sequence_date=seq_date) or _('New') result = super(Transfers, self).create(vals) return result


0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now