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

i added a button to update a field in product template from another computed field but when i press this button only self product be update and the method didn't go over all product

i tried a lotin this problem but i can't solve it and this the simple i have added

@api.multi
def button_name(self):
    for template in self:
        self.name4 = self.name3

    pass
アバター
破棄
最善の回答

Try this

@api.multi
def button_name(self):
    products = self.env['product.template'].search([]) for product in products:
product.name4 = product.name3
pass
アバター
破棄

hello, dear is this automatically saving updated value in DB . or do I have to run the write function

著作者

yes the values updated after press the button automatically

最善の回答

Use lamda function

アバター
破棄
関連投稿 返信 ビュー 活動
1
10月 23
10680
1
12月 22
10548
2
12月 22
2562
0
11月 23
1188
3
3月 21
4862