İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
10657 Görünümler

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
Avatar
Vazgeç
En İyi Yanıt

Try this

@api.multi
def button_name(self):
    products = self.env['product.template'].search([]) for product in products:
product.name4 = product.name3
pass
Avatar
Vazgeç

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

Üretici

yes the values updated after press the button automatically

En İyi Yanıt

Use lamda function

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Eki 23
10684
1
Ara 22
10557
2
Ara 22
2571
0
Kas 23
1200
3
Mar 21
4866