Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
2996 Lượt xem

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,
    }

 

 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello

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

you can used product fields also.

Ảnh đại diện
Huỷ bỏ