コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3080 ビュー

hi, i want to give an automatic value to my field idarticle with fuction detarticle but it doesn't work. below is my code

[code]

@api.onchange('idcuve')
def getarticle(self):
    for rec in self:
        if rec.idcuve != False :

            rec.idarticle = idcuve.idarticle 

[/code]

my others class are 

class ostation_cuve(models.Model):
_name = "ostation.cuve"

name = fields.Char(string='Libellé', required=True)
idarticle = fields.Many2one('ostation.article', 'Article', required=True )


class ostation_article(models.Model):
_name = "ostation.article"
_description = "article"

name = fields.Char(string='Nom', required=True)
prix = fields.Char(string='Prix de vente', required=True)
cout = fields.Char(string="Coût d'achat")

アバター
破棄
関連投稿 返信 ビュー 活動
1
6月 25
25864
2
7月 22
4581
1
9月 21
4277
3
9月 21
9067
2
9月 21
10189