تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
6333 أدوات العرض

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

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
أغسطس 23
8
2
نوفمبر 22
3369
1
أكتوبر 20
7160
2
مارس 15
4577
0
ديسمبر 22
2363