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

hi,

i created one custom module in odoo v9

in controller i am not pass any "auth" parameter

after login administrator in odoo it submit form and work perfectly

but when i create another user in odoo from signup form and try to submit form so it return 403:forbidden errore

in log file it look like

"

AccessError: (u'Sorry, you are not allowed to create this kind of document. Please contact your system administrator if you think this is an error.\n\n(Document model: consulate.afidavit)', None)

"
so how can i solve this error

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,


When you create you new object you should use:

request.env['..'].sudo().create('..');

In the old API you should use:

from openerp import SUPERUSER_ID

request.registry['...'].create(cr, SUPERUSER_ID, place.id, ..., context)

Then you are in the super user right.

Best Regards

Ảnh đại diện
Huỷ bỏ
Tác giả

hi,Thanks for your reply but in my controller i am not create any user,only get login user detail from "cust = http.request.env.user" and save in res.partner(onetomany) fields like "'partner_id': cust.id," it works in only when admin is logged in otherwise it return 403:forbidden error,so how we remove this error

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 1 16
4873
3
thg 1 16
7200
0
thg 7 16
3932
3
thg 12 19
8291
2
thg 4 19
6410