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

in my module I call compose message wizard like this:

...
return {
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'mail.compose.message',
'views': [(compose_form_id, 'form')],
'view_id': compose_form_id,
'target': 'new',
'context': ctx,
}
the wizard shows but the send mail fails with access denied error because the user has no writing rights to the model . So I want to call the wizard with root privileges?
I know about sudo() but in this case I cannot use it. Is there a way to pass uid as a context to the action?
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

You can change self to self.sudo() within method where you've added this wizard.

Thanks!

อวตาร
ละทิ้ง
ผู้เขียน

it's called from a button:

<button name="action_send_mail" string="Send by Mail" type="object"/>

I cannot use sudo() there

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ส.ค. 23
8
2
พ.ย. 22
3468
1
ต.ค. 20
7250
2
มี.ค. 15
4635
0
ธ.ค. 22
2421