AttributeError:"NoneType"对象没有属性"_columns" [英] AttributeError: 'NoneType' object has no attribute '_columns'

查看:167
本文介绍了AttributeError:"NoneType"对象没有属性"_columns"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在OpenERP中编写一个将从Accounts模块继承的模块.下面是我的简化代码

I am writing a module in OpenERP that would inherit from the Accounts module. Below is my simplified code

from osv import fields, osv
import decimal_precision as dp

class account_molly(osv.osv):

    def __computeOB(self, cr, uid, ids, context=None):
        res = []
        return 0

    def __computeCB(self, cr, uid, ids, context=None):
        res = []
        return 0

    _name = "account.molly"
    _description = "This is Molly Special Account View"
    _inherit = "account.account"
    _columns = {
        'opening_balance': fields.function(__computeOB, digits_compute=dp.get_precision('Account'), method=True, string='Opening Balance'),
        'end_balance': fields.function(__computeCB, digits_compute=dp.get_precision('Account'), method=True, string='End Balance'),
    }   

account_molly()

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

当我尝试安装模块时,我得到

When I try to install the module, I get

AttributeError: 'NoneType' object has no attribute '_columns'

请问可能是什么问题

推荐答案

请检查您创建的模块的依赖性.在 openerp .py文件的依赖项列表中,如果未添加帐户",请添加它.如果这样不能解决您的问题,请提供错误日志

Please check the dependency of the module you have created. In the openerp.py file, in the dependency list if 'account' is not added, please add it. If this didnt solve your problem please provide the error log

这篇关于AttributeError:"NoneType"对象没有属性"_columns"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆