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

Let's say I add attachments to products. 

How can enable all uploaded images to be available to public by default?

Ảnh đại diện
Huỷ bỏ

where do you add this code 

Tác giả Câu trả lời hay nhất
I solved it by:
@api.model
def create(self, vals):
picture_public = {'public': True}
vals.update(picture_public)
return super().create(vals

Ảnh đại diện
Huỷ bỏ

would be great if you described some context, as @Mohamed asked...
I have a situation where I want to enable this option for existing images too.
Which model should I inherit to change it for good?

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 12 24
1489
2
thg 4 22
4131
0
thg 10 21
2664
2
thg 5 20
12235
2
thg 12 17
4328