Odoo Help


what is the usage of _inherits = {'product.category':'cat_id'} and which scenario I can use this one?

on 4/28/16, 8:01 AM 802 views


class hotel_room_amenities_type(osv.osv):

_name = 'hotel.room_amenities_type'

_description = 'amenities Type'

_inherits = {'product.category':'cat_id'}

_columns = {

'cat_id':fields.many2one('product.category', 'category', required=True, ondelete='cascade'),


_defaults = {

'isamenitype': lambda * a: 1,


class product_category(osv.osv):

_inherit = "product.category"

_columns = {

'isroomtype':fields.boolean('Is Room Type'),

'isamenitype':fields.boolean('Is amenities Type'),

'isservicetype':fields.boolean('Is Service Type'),




class HotelRoomAmenitiesType(models.Model):  
 _name = 'hotel.room.amenities.type' _description = 'amenities Type'
 cat_id = fields.Many2one('product.category', 'category', required=True, delegate=True, ondelete='cascade')


Jignesh Mehta

--Jignesh Mehta--
| 6 5 8
Surat, India
--Jignesh Mehta--

- I have 3+ years of Industry Experience, specializing Odoo Development, Analysis, Customization, Implementation, Integration.
- I have done many Customization modules in Sale, Purchase, Point of Sale, Inventory, CRM and much more. Also Worked in the Odoo Themes like Business Theme or E-Commerce Theme.
- Develop Jewelery Manufacturing process from Scratch. It have more than 10 Department. Develop PDF and Excel reports for this project around 150 per format.

Jignesh Mehta
On 4/28/16, 8:10 AM

Hello Dep,

_inherits means you can access all the fields from existing class but in database, there is create a new table for it.

For Ex:-

In your custom class hotel_room_amenities_type, you can access all the fields from the product.category but in database there is create new table for your class.

In your custom class, you may give the many2one fields for existing models is compulsory.

_inherit means you extend the existing model.



on 4/28/16, 8:22 AM

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

1 follower(s)


Asked: 4/28/16, 8:01 AM
Seen: 802 times
Last updated: 4/28/16, 8:10 AM