Actually, I have two questions:
The first one: Is there any difference between the following code snippet?
class Pallet(models.Model):
_name = 'test.pallet'
_inherits = {'test.box': 'box_id'}
_description = 'Test Pallet'
box_id = fields.Many2one('test.box', 'Box', required=True,
ondelete='cascade')
field_in_pallet = fields.Char('Field2')
class Pallet(models.Model):
_name = 'test.pallet'
_description = 'Test Pallet'
box_id = fields.Many2one('test.box', 'Box', required=True,
ondelete='cascade',delegate=True)
field_in_pallet = fields.Char('Field2')
And the second one: If I use _inherits in code, I cannot see there is any difference without it in my code. For example:
class Pallet(models.Model):
_name = 'test.pallet'
_inherits = {'test.box': 'box_id'}
_description = 'Test Pallet'
box_id = fields.Many2one('test.box', 'Box', required=True,
ondelete='cascade')
field_in_pallet = fields.Char('Field2')
class Pallet(models.Model):
_name = 'test.pallet'
_description = 'Test Pallet'
box_id = fields.Many2one('test.box', 'Box', required=True,
ondelete='cascade')
field_in_pallet = fields.Char('Field2')
A sample Many2one field is enough.