Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
10693 Переглядів

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
жовт. 23
10718
1
груд. 22
10598
2
груд. 22
2630
0
лист. 23
1242
3
бер. 21
4889