2012-05-12 4 views
1

계정 모듈에서 상속받을 모듈을 OpenERP에 작성하고 있습니다. 아래는 내가 모듈을 설치하려고하면 내가 얻을 내 간단한 코드AttributeError : 'NoneType'객체에 '_columns'속성이 없습니다.

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'
무엇이 문제이 문제를 해결 않습니다

+0

을 제공하십시오. – cobie

+0

는 OpenERP [문서] (http://doc.openerp.com/v6.0/developer/2_5_Objects_Fields_Methods/object_attributes.html)에 따르면, 당신은'_name = name.of.the.object' 특성이 필요합니다. –

+0

이름 속성을 사용하더라도 여전히 동일한 오류가 발생했습니다. 나는 그것을 제거하여 sale_crm 모듈의 메인 파이썬 파일을 원합니다. –

답변

3

을 혼합하는 것. openerp .py 파일에서 '계정'이 추가되지 않은 경우 종속성 목록에 추가하십시오. 문제가 해결되지 않으면 가져 오거나 설치할 때 오류 로그

-1

될 수주십시오?

class account_molly(osv): 
    ... 

당신은 당신이 만든 모듈의 의존성을 확인하시기 바랍니다 모듈과 클래스와 클래스 속성

+0

내 init.py 파일에있는 것입니다. 어쨌든 나는 그것을 시도하고 이것이 내가 가진 오류이다 TypeError : Metaclass베이스를 호출 할 때 에러가 발생한다. 모듈 .__ init __()은 최대 2 개의 인수 (3이 주어진다) –

관련 문제