Skip to Content
Menu
This question has been flagged
2 Replies
1771 Rodiniai

supprose i have this 2 class: 


class Personne(models.Model):

    _name = "personne"

    

name = fields.Char(string="name")

birth = fields.Date(string="Birth date")

class inscription(models.Model):

    _name = "inscription"

    

    name = fields.Char(string="Date")

personne = fields.Many2one('personne', string='Personne')

    birth = fields.Many2one('personne', string='Birth date')

in class "inscription" the value of birth should be related to shoosed personne

how can i set birth value automaticaly after personne choosed?

Portretas
Atmesti

Odoo Customization Tips: https://goo.gl/8HgnCF

Best Answer

Hi, 

You can rewrite the birth field in model inscription As

birth = fields.Date(string="Birth date", related='personne.birth')

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
3
spal. 23
9064
1
rugs. 23
3431
1
geg. 23
2406
2
bal. 23
2977
1
kov. 23
2355