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

Hello there,

I want the public user (id3) see all products of all companies on front-end shop.

So I add something to the original rule :

['|','|','|',(user.id,'=',3),('company_id.child_ids','child_of',[user.company_id.id]),('company_id','child_of',[user.company_id.id]),('company_id','=',False)]


But I get this error :

            Error

            Error message:

            Invalid leaf (8, '=', 3)


Somebody could help?


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

una alternativa [('create_uid','=',3)] or [('create_uid','=',user.id)]

Câu trả lời hay nhất

I think that kind of assignation ('user.id','=',3) does not logically make sense, as the left side argument is normally a field or property that comes from the model, and the right side argument is the value you want to compare it to.

For example, if the model had a field, user_id, then you could use:

('user_id','=',3) or ('user_id','=',user.id) 

---------------------

I don't know if this is a correct example, but your current record rule would be like trying to write a SQL query like:

select * from res_partner where 3=user_id

instead of:

select * from res_partner where user_id=3;
Ảnh đại diện
Huỷ bỏ
Tác giả

interesting. thank you. But how could I get the logged user in this rule of product.template?

Yea, I'm struggling with that as well. It would have been really useful - I'm still looking out for a solution. Sorry I couldn't help out on that.

Check out this post. You may be able to use the solution for your case: https://www.odoo.com/forum/help-1/question/how-to-filter-records-based-on-groups-26982

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 15
3375
1
thg 10 16
4142
1
thg 12 24
4064
0
thg 11 24
1667
2
thg 7 24
3403