简体   繁体   English

安装自定义模块(最近一次调用最近)时出现错误

[英]error when install custom module (most recent call last) odoo

this error appear when install the module i'm trying to make two level validation on sales order Traceback (most recent call last) 安装模块时,我尝试对销售订单回溯进行两级验证(最近一次通话最近),将出现此错误

    Traceback (most recent call last):
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/http.py", line 537, in handle_exception
return super(JsonRequest, self).handle_exception(exception)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/http.py", line 574, in dispatch
result = self._call_function(*self.params)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/http.py", line 310, in _call_function
return checked_call(self.db, *args, *kwargs)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/service/model.py", line 118, in wrapper
return f(dbname, args, *kwargs)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/http.py", line 307, in checked_call
return self.endpoint(a, *kw)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/http.py", line 803, in __call
return self.method(args, *kw)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/http.py", line 403, in response_wrap
response = f(args, *kw)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/addons/web/controllers/main.py", line 948, in call_button
action = self.call_kw(model, method, args, {})
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/addons/web/controllers/main.py", line 936, in call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, args, *kwargs)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/api.py", line 256, in wrapper
return old_api(self, args, *kwargs)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/addons/base/module/module.py", line 447, in button_immediate_install
return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/api.py", line 256, in wrapper
return old_api(self, args, *kwargs)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/addons/base/module/module.py", line 495, in _button_immediate_function
registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/modules/registry.py", line 370, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/modules/loading.py", line 355, in load_modules
loaded_modules, update_module)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/modules/loading.py", line 255, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/modules/loading.py", line 143, in load_module_graph
load_openerp_module(package.name)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/modules/module.py", line 315, in load_openerp_module
__import('openerp.addons.' + module_name)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/modules/module.py", line 80, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/addons/sales_approval/init.py", line 1, in 
import salesapproval
File "/opt/bitnami/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/addons/sales_approval/salesapproval.py", 
line 3



_inherit = 'sale.order'
^
IndentationError: expected an indented block

and this my files 这是我的文件

init .py 初始化 .py

import salesapproval

openerp .py openerp .py

{
'name': 'Screen Printing',
'version': '1.0',
'description': """
This module adds functionality for 
screen printing companies
""",
'author': 'test',
'depends': ['base','sale'],
'data': ['sale_appr.xml'],
'demo': [],
'installable': True,
'auto_install': False,
}

sale_appr.xml sale_appr.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="sale_view_order_form" model="ir.ui.view">
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<button name="print_quotation" position="after">
<button name="approve_art" string="Approve Art" 
states="draft,sent" groups="base.group_user"/>
</button>
<button name="action_button_confirm" position="attributes">
<attribute name="states">art_approved</attribute>
</button>
<button name="print_quotation" position="attributes">
<attribute name="states">draft,sent,art_approved</attribute>
</button>
<button name="cancel" position="attributes">
<attribute name="states">draft,sent,art_approved</attribute>
</button>
</field>
</record>
</data>
</openerp>

salesapproval.py salesapproval.py

from openerp.osv import osv, fields
class salesapproval_sale_order(osv.Model):
_inherit = 'sale.order'
_columns = {
'state': fields.selection(
                [('cancel', 'Cancelled'),('draft', 'Draft'),('confirmed', 'Confirmed'),('exception', 'Exception'),('done', 'Done')],
                'Status', required=True, readonly=True, copy=False,
                help='* The \'Draft\' status is set when the related sales order in draft status. \
                    \n* The \'Confirmed\' status is set when the related sales order is confirmed. \
                    \n* The \'Exception\' status is set when the related sales order is set as exception. \
                    \n* The \'Done\' status is set when the sales order line has been picked. \
                    \n* The \'Cancelled\' status is set when a user cancel the sales order related.'),

}

thanks in advance 提前致谢

You forgot to indent your code block 您忘了缩进代码块

# DO NOT DO THIS
class salesapproval_sale_order(osv.Model):
_inherit = 'sale.order'
# code

# DO THIS
class salesapproval_sale_order(osv.Model):
    _inherit = 'sale.order'
    # code

The error tells you exactly what is wrong. 该错误告诉您确切的问题是什么。 You have an indentation error in the salesapproval.py file at the line _inherit = 'sale.order' 您的salesapproval.py文件中的_inherit = 'sale.order'_inherit = 'sale.order'缩进错误

Everything within class salesapproval_sale_order should be indented one block. class salesapproval_sale_order所有class salesapproval_sale_order都应缩进一格。

class salesapproval_sales_order(osv.Model):
    _inherit = 'sale.order'
    ....

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么“回溯(最近一次通话最后一次):文件”<stdin> ”,第 1 行,在<module> ImportError:当我尝试安装 django 时,没有名为 django 的模块?</module></stdin> - why 'Traceback (most recent call last): File “<stdin>”, line 1, in <module> ImportError: No module named django' when im trying to install django? 当我启动这段代码时,我在 pygame 模块的代码中发现了错误 Traceback (last last call last) 的问题 - When I start this code, i found a problem with error Traceback (most recent call last) in my code with pygame module 解释“回溯(最近一次调用最后一次):”错误 - Interpreting a “Traceback (most recent call last):” error Traceback(最近一次通话最后一次)Python 错误 - Traceback (most recent call last) Python Error Python追踪(最近一次通话)错误 - Python Traceback (most recent call last) error 修复回溯(最近一次通话最近)错误? - Fixing Traceback (most recent call last) error? Python 错误回溯(最后一次调用): - Python Error Traceback (most recent call last): pip install paho-mqtt追溯(最近一次调用) - pip install paho-mqtt traceback (most recent call last) 追溯(最近一次通话):“文件” <stdin> ”,第1行,在 <module> - Traceback (most recent call last): File “<stdin>”, line 1, in <module> Python sounddevice 模块输出 Traceback(最近一次调用最后一次): - Python sounddevice module outputs Traceback (most recent call last):
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM