我想在oddo 11中的sale.order中添加一个自定义字段。但是,每当我提起销售订单时,就会突然出现此意外错误“未捕获错误:NameError:未定义名称'true'”。
清单 .py
{
'name': 'Screen Printing',
'version': '1.0',
'description': """
This module adds functionality for screen printing companies.
===============================================
""",
'author': 'Ahmed Sheikh',
'depends': ['base','sale'],
'demo': [],
'data': ['silkworm_views.xml'],
'installable': True,
'auto_install': False,
}
init .py
from . import silkworm
silkworm.py
from odoo import models, fields
class silkworm_sale_order(models.Model):
_inherit = 'sale.order'
daterequired = fields.Date('Date Required', required=True)
rush = fields.Boolean('Rush Order')
silkworm_views.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="sale_view_order_form" model="ir.ui.view">
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="payment_term_id" position="after">
<field name="daterequired"/>
<field name="rush"/>
</field>
</field>
</record>
</data>
</odoo>
这是完整的错误消息:
http://localhost:8069/web/content/492-440210e/web.assets_backend.js:144
Traceback:
Error: NameError: name 'true' is not defined
at PY_ensurepy (http://localhost:8069/web/content/492-
440210e/web.assets_backend.js:144:65)
at Object.py.evaluate (http://localhost:8069/web/content/492-
440210e/web.assets_backend.js:259:8)
at Object.py.evaluate (http://localhost:8069/web/content/492-
440210e/web.assets_backend.js:265:111)
at Object.py.evaluate (http://localhost:8069/web/content/492-
440210e/web.assets_backend.js:267:99)
at Object.py.eval (http://localhost:8069/web/content/492-
440210e/web.assets_backend.js:272:284)
at http://localhost:8069/web/content/492-
440210e/web.assets_backend.js:380:136
at Function._.each._.forEach (http://localhost:8069/web/content/368-
f2074dd/web.assets_common.js:12:558)
at _.<computed> [as each] (http://localhost:8069/web/content/368-
f2074dd/web.assets_common.js:69:526)
at eval_domains (http://localhost:8069/web/content/492-
440210e/web.assets_backend.js:379:265)
at Object.pyeval [as eval] (http://localhost:8069/web/content/492-
440210e/web.assets_backend.js:393:24)