Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
6767 มุมมอง

Let's say I add attachments to products. 

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

อวตาร
ละทิ้ง

where do you add this code 

ผู้เขียน คำตอบที่ดีที่สุด
I solved it by:
@api.model
def create(self, vals):
picture_public = {'public': True}
vals.update(picture_public)
return super().create(vals

อวตาร
ละทิ้ง

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?

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ธ.ค. 24
1556
2
เม.ย. 22
4228
0
ต.ค. 21
2744
2
พ.ค. 20
12312
2
ธ.ค. 17
4398