Yaseen Shareef
Yaseen Shareef

Reputation: 767

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. I am attaching my code here:

The 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:

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.

Upvotes: 0

Views: 1910

Answers (1)

dgeorgiev
dgeorgiev

Reputation: 941

Here's a list of the things I normally miss when wondering why my changes don't take effect:

  • Import the module .py files in __init__.py
  • Add the xml file to __openerp__.py
  • Upgrade the module after changes affecting db/views.
  • If it is a new module, install it. Make sure it does not get ignored, because module list has not been updated.

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.

Upvotes: 1

Related Questions