Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
10642 Lượt xem

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
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Try this

@api.multi
def button_name(self):
    products = self.env['product.template'].search([]) for product in products:
product.name4 = product.name3
pass
Ảnh đại diện
Huỷ bỏ

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

Tác giả

yes the values updated after press the button automatically

Câu trả lời hay nhất

Use lamda function

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 10 23
10680
1
thg 12 22
10548
2
thg 12 22
2561
0
thg 11 23
1186
3
thg 3 21
4862