我试图通过以下代码
继承odoo 8中的account.analytic.default
class analytic_default1(osv.osv):
_inherit = "account.analytic.default"
_columns = {
'x_analytics': fields.many2one('account.account', 'Account'),
}
但它给了我以下错误
XmlHttpRequestError INTERNAL SERVER ERROR
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
答案 0 :(得分:1)
如果它与您在服务器上运行的代码完全相同, 你的缩进是错误的。此外,我建议使用新的API。 下面的代码应该没有错误。
旧API
from openerp.osv import fields, osv
class analytic_default1(osv.osv):
_inherit = "account.analytic.default"
_columns = {
'x_analytics': fields.many2one('account.account', 'Account'),
}
新API
from openerp import fields, models
class AnalyticDefault(models.Model):
_inherit = "account.analytic.default"
x_analytics = fields.Many2one(
'account.account',
'Account'
)