تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
1784 أدوات العرض

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?

الصورة الرمزية
إهمال

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

أفضل إجابة

Hi, 

You can rewrite the birth field in model inscription As

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
3
أكتوبر 23
9118
1
سبتمبر 23
3438
1
مايو 23
2420
2
أبريل 23
2993
1
مارس 23
2365