Odoo Help

Welcome!

This community 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.

1

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

By
Juan Carlos
on 12/22/14, 6:59 PM 895 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.

my.py

from openerp import models, fields, api


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

 

my.xml

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <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>
            </field>
        </record>

        <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"/>
                </field>
            </field>
        </record>

        <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"/>


    </data>
</openerp>

can you please explain what you need to do?

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

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

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

Hi,

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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

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