Odoo 8 在尝试在销售订单行中添加新字段时出现问题,表单根本无法保存,如果我的代码有任何问题,我不会。我在这里附上我的代码:
sale_view.xml:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_order_line_tree_inherited" model="ir.ui.view">
<field name="name">sale.order.line.tree.inherited</field>
<field name="model">sale.order.line</field>
<field name="inherit_id" ref="sale.view_order_line_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name='no_end_product'/>
<field name='length'/>
<field name='width'/>
</xpath>
</field>
</record>
</data>
</openerp>
销售.py:
import logging
from openerp.osv import fields, osv
from openerp import tools
from openerp.tools.translate import _
class sale_order_line(osv.osv):
_inherit='sale.order.line'
_columns= {
'length': fields.float("Length"),
'width': fields.float("Width"),
'no_end_product': fields.integer("End Product No."),
}
sale_order_line()
然而,相同的代码在 Openerp 7 中运行良好,我想知道在 Odoo 8 中是什么造成了问题。任何快速修复将不胜感激。