[英]Adding New Field In order line Odoo 8
There is a problem in Odoo 8 while trying to add a new field in sale order line, the form simply doesn't save, I don't if anything's wrong with my code. 尝试在销售订单行中添加新字段时,Odoo 8中存在问题,该表单根本无法保存,如果我的代码有任何问题,我也不会。 I am attaching my code here:
我在这里附上我的代码:
The sale_view.xml: 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>
The sale.py: sale.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()
However the same code works fine in Openerp 7, I wonder what's creating a problem in Odoo 8. Any quick fix would be greatly appreciated. 但是,相同的代码在Openerp 7中工作正常,我想知道是什么在Odoo 8中造成了问题。任何快速修复都将不胜感激。
Here's a list of the things I normally miss when wondering why my changes don't take effect: 当想知道为什么我的更改无法生效时,以下是我通常会错过的事情:
__init__.py
__init__.py
__openerp__.py
__openerp__.py
db/views
. db/views
更改之后升级模块。 A simple way to check if odoo is ignoring the files entirely is to introduce an error in them and see if an error will pop in the logs. 检查odoo是否完全忽略文件的一种简单方法是在文件中引入错误,然后查看日志中是否会弹出错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.