Odoo Help


How inherit sale.order.line in my class, and it is possible?

Juan Carlos
on 12/22/14, 6:59 PM 1,420 views

Hi I watch an example of inherit with product.product, and I wondering if I can use sale.order.line instead product.product but apparently, is very diferent.


from openerp import models, fields, api

class Primaria(models.Model):
    _inherit = "sale.order.line"
    lel= fields.Char(string="lol")



<?xml version="1.0" encoding="UTF-8"?>
        <record model="ir.actions.act_window" id="super_sale_order">
            <field name="name">Agregar empresas</field>
            <field name="res_model">sale.order.line</field>
            <field name="view_type">form</field>
            <field name="view_mode">kanban,tree,form</field>
            <field name="help" type="html">
            <p class="oe_view_nocontent_create">Agrega la primera empresa</p>

        <record model="ir.ui.view" id="product_normal_form_view_inherit">
            <field name="model">sale.order.line</field>
            <field name="inherit_id" ref="sale.order.line_normal_form_view"/>
            <field name="arch" type="xml">
                <field name="name" position="after">
                    <field name="lel"/>

        <menuitem id="super_menu" name="Velfasa"/>
        <!-- Submenu 1-->
        <menuitem id="menudos" name="Open Academy" parent="super_menu"/>
        <menuitem id="ingreso_de_facturas" name="Ingreso de facturas" parent="menudos" action="super_sale_order"/>


can you please explain what you need to do?

Baiju KS
on 12/22/14, 11:34 PM
On 12/23/14, 3:13 AM

in code .xml   <field name="model">sale.order</field> use sale.order.line just in code.py

Sascha Pfeiffer
On 12/23/14, 3:04 AM


If you want to inherit sale.order.line, then use this code snippet for guidance :)

In your .py File

from openerp.osv import fields, osv

class new_sale_order_line(osv.Model):
    _name = 'sale.order.line'
    _inherit = 'sale.order.line'


    _columns = {
        'lel': fields....

To give you advice on your xml I would need more informations.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 12/22/14, 6:59 PM
Seen: 1420 times
Last updated: 3/16/15, 8:10 AM