Skip to Content
Menu
This question has been flagged
2 Replies
3889 Views

iam trying to upgrade my custom module , when i tried to restart my odoo server iam getting this error and cant able to start it

IndentationError: unindent does not match any outer indentation level
2020-03-17 04:06:11,395 11698 INFO odoo werkzeug: 127.0.0.1 - - [17/Mar/2020 04:06:11] "POST /longpolling/poll HTTP/1.1" 500 - 9 0.008 0.190
2020-03-17 04:06:11,398 11698 ERROR odoo werkzeug: Error on request:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 270, in run_wsgi
    execute(self.server.app)
  File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 258, in execute
    application_iter = app(environ, start_response)
  File "/odoo/odoo-server/odoo/service/server.py", line 439, in app
    return self.app(e, s)
  File "/odoo/odoo-server/odoo/service/wsgi_server.py", line 142, in application
    return application_unproxied(environ, start_response)
  File "/odoo/odoo-server/odoo/service/wsgi_server.py", line 117, in application_unproxied
    result = odoo.http.root(environ, start_response)
  File "/odoo/odoo-server/odoo/http.py", line 1282, in __call__
    return self.dispatch(environ, start_response)
  File "/odoo/odoo-server/odoo/http.py", line 1252, in __call__
    return self.app(environ, start_wrapped)
  File "/usr/local/lib/python3.6/dist-packages/werkzeug/wsgi.py", line 766, in __call__
    return self.app(environ, start_response)
  File "/odoo/odoo-server/odoo/http.py", line 1434, in dispatch
    odoo.registry(db).check_signaling()
  File "/odoo/odoo-server/odoo/__init__.py", line 104, in registry
    return modules.registry.Registry(database_name)
  File "/odoo/odoo-server/odoo/modules/registry.py", line 62, in __new__
    return cls.new(db_name)
  File "/odoo/odoo-server/odoo/modules/registry.py", line 86, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/odoo/odoo-server/odoo/modules/loading.py", line 419, in load_modules
    force, status, report, loaded_modules, update_module, models_to_check)
  File "/odoo/odoo-server/odoo/modules/loading.py", line 315, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/odoo/odoo-server/odoo/modules/loading.py", line 182, in load_module_graph
    load_openerp_module(package.name)
  File "/odoo/odoo-server/odoo/modules/module.py", line 381, in load_openerp_module
    __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


sequen.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,
}


Avatar
Discard
Best Answer

Hi, Guna

Above query is already answered in

https://www.odoo.com/forum/help-1/question/odoov13-unindent-does-not-match-any-outer-indentation-level-167138 

So please refer to that solution in order to fix this issue.
Also , 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
Avatar
Discard
Best Answer

Hi

you did mistake in .py file. added one extra white space in all line where you field defined i changed code according please use below code and remove extra white space if you have it any other place

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


Thanks
Avatar
Discard