Skip to Content
मेन्यू
This question has been flagged

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
Discard
Best Answer

Try this

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

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

Author

yes the values updated after press the button automatically

Best Answer

Use lamda function

Avatar
Discard
Related Posts Replies Views Activity
1
अक्तू॰ 23
10684
1
दिस॰ 22
10567
2
दिस॰ 22
2586
0
नव॰ 23
1212
3
मार्च 21
4867