问题
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'
Please what could be the problem
回答1:
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
回答2:
does this solve the problem?
class account_molly(osv):
...
you seem to mix module and class and class attribute
来源:https://stackoverflow.com/questions/10565288/attributeerror-nonetype-object-has-no-attribute-columns