Odoo Help


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.


How to inherit class ?

Prince Caspion
on 1/1/15, 4:08 AM 663 views

Hello All,

I want to add one field in side the sale order module by custom module how can I add?

Thanks in advance.


Anil R. Kesariya

--Anil R. Kesariya--
| 6 5 8
Gandhinagar, India
--Anil R. Kesariya--
ERP Consultant

Key Skill
Technical & Functional Expert
Anil R. Kesariya
On 1/1/15, 4:22 AM


Here you go!

#class file yourfile.py

#Example With APi.

from openerp import models, fields, api,

class sale_order(models.Model)

    _inherit = 'sale.order'

    your_field = fields.Char("Your Field Label")

    #instead Char you apply any type of field whatever you need from this field list you can use

    #Char,Integer,Date,Float,Many2one,One2many,Many2many,Related etc...

    #First later of each field type must be capital in odoo  v8. if you follow the v8 codding standard,

#Example Without Api (With v7 codding standard)

from openerp.osv import osv, fields

class sale_order(osv.Model)

    _inherit = 'sale.order'

    _columns = {

    'your_field':fields.char("Label of your Field", size=64),


#Now in xml file you can add this field by using xpath concept by inherting exsisting view.

Let me know if you face any difficuties on this.







Demirel yakito
On 1/1/15, 6:43 AM

just create a class in your customer module, and inside that class you inherit that sales order model. Then use of xpath create field in customer xml file.

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

1 follower(s)


Asked: 1/1/15, 4:08 AM
Seen: 663 times
Last updated: 3/16/15, 8:10 AM