我编写自定义模块,但我的_defaults函数有问题。
当我安装模块时,它会抛出错误
缩进错误:“_defaults = {”。
的意外缩进
medical_diagnostic_hypothesis.py
from openerp.osv import fields, orm
class MedicalDiagnostic_hypothesis(orm.Model):
_name = 'medical.diagnostic_hypothesis'
#_inherit = ['mail.thread', 'ir.needaction_mixin']
_columns = {
'name': fields.char(size=256, string='Diagnostic ID', required=True),
'partner_id': fields.many2one('res.partner', 'Partner',
required=True ),
'pathology_category_id': fields.many2one('medical.pathology.category',
'Pathology',required=True ),
'diagnostic': fields.char(size=256, string='Diagnostic'),
'treatment_method': fields.char(size=256, string='Treatment Method'),
}
_defaults = {
}
答案 0 :(得分:0)
尝试使用此代码。 (做一个适当的缩进)
medical_diagnostic_hypothesis.py
from openerp.osv import fields, orm
class MedicalDiagnostic_hypothesis(orm.Model):
_name = 'medical.diagnostic_hypothesis'
#_inherit = ['mail.thread', 'ir.needaction_mixin']
_columns = {
'name': fields.char(size=256, string='Diagnostic ID', required=True),
'partner_id': fields.many2one('res.partner', 'Partner',
required=True ),
'pathology_category_id': fields.many2one('medical.pathology.category',
'Pathology',required=True ),
'diagnostic': fields.char(size=256, string='Diagnostic'),
'treatment_method': fields.char(size=256, string='Treatment Method'),
}
_defaults = {
}
的更多信息