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.


What is the use of _inherits = {'product.product':'service_id'} from my code

on 10/14/14, 7:27 AM 597 views

class hotel_services(osv.Model):
    _name = 'hotel.services'
    _description = 'Hotel Services and its charges'
    _inherits = {'product.product':'service_id'}  # explain this code
    _columns = {
        'service_id': fields.many2one('product.product', 'Service_id', required=True, ondelete='cascade'),
    _defaults = {
        'isservice': 1,



Piyush Suva
On 10/14/14, 8:28 AM

In short , You will get all functionality of product.product object into 'hotel.services' object.

when you create record in hotel.services at that time its related record also created in product.product object.

product.product work as parent and  hotel.services work as child. so child will get all functionality of his parent.

you can access fields of product.product into hotel.services. Even in form/tree view of hotel.services, you can define Fields of product.product.

Its inheritance concept

    product.product -> hotel.services

same like:

     product.template -> product.product,

    account.analytic.account -> project.project.


Nirav Jani
On 10/14/14, 8:07 AM


In case create new table for 'hotel.services' object with link to product table.

you can used product fields also.

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)


Asked: 10/14/14, 7:27 AM
Seen: 597 times
Last updated: 3/16/15, 8:10 AM