Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use Delegation method in openERP/Odoo ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 296
    Comment on it

    The delegation method is performed the reference fields automatically set up on the parent model:
    For example you can take idea from below code-

    class Child0(models.Model):
        _name = 'delegation.child0'
    
        field_0 = fields.Integer()
    
    class Child1(models.Model):
        _name = 'delegation.child1'
    
        field_1 = fields.Integer()
    
    class Delegating(models.Model):
        _name = 'delegation.parent'
    
        _inherits = {
            'delegation.child0': 'child0_id',
            'delegation.child1': 'child1_id',
        }
    
        child0_id = fields.Many2one('delegation.child0', required=True, ondelete='cascade')
        child1_id = fields.Many2one('delegation.child1', required=True, ondelete='cascade')
            record = env['delegation.parent'].create({
                'child0_id': env['delegation.child0'].create({'field_0': 0}).id,
                'child1_id': env['delegation.child1'].create({'field_1': 1}).id,
            })
            record.field_0
            record.field_1

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: