gpt4 book ai didi

python - 属性错误: 'NoneType' object has no attribute '_columns'

转载 作者:行者123 更新时间:2023-12-01 06:00:50 25 4
gpt4 key购买 nike

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

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:

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

AttributeError: 'NoneType' object has no attribute '_columns'
请问可能是什么问题

最佳答案

请检查您创建的模块的依赖关系。 openerp.py文件中,依赖列表中如果没有添加“account”,请添加。如果这没有解决您的问题,请提供错误日志

关于python - 属性错误: 'NoneType' object has no attribute '_columns' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10565288/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com