This kind of scenario comes up when we want same set of fields to be repeated in core modules.

For eg., if I want order status page to be displayed in Sales and Purchase Order both. So, I define a order_status object which holds the common fields. Then I will inherit sale_order and purchase_order objects and also inherit order_status object.

Now, the next question is to how to assign more than one object to _inherit attribute. The trick is to define multiple class in list as follows-

class sale_order(osv.osv):
  _name='sale.order'
  _inherit=['sale.order','order.status']

 


class purchase_order(osv.osv):
  _name='purchase.order'
  _inherit=['purchase.order','order.status']

Advertisements