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

DEAR ALL,

I configured two child companies co1 co2 under co

and I have 2 users as below

user1 allowed to co1

user2 allowed to co2

my problem is when user1 create a new vehicule the user2 can view it

do you have the same problem, and if yes, how you solved it

thank you

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

Hi , 
You must add default value ( default=lambda self: self.env.user.company_id) to company_id in model  'fleet.vehicle'  


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

thank you Salman for your help, it was a pleasure;)

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

Hi,

By just adding a company field the problem wont get sorted out, after adding the company field for the fleet.vehicle model you have to write a record rule for the same model such a way that the visibility of the records get controlled.



You can add a field named company_id by inheriting the model fleet.vehicle from the code and set default value as the current company of the user.


Thanks

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

thank you Niyas, great solution

Tác giả Câu trả lời hay nhất

okay, where to put it , here a screenshot

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

you should write it on code

Tác giả

the solution proposed by Niyas solved my problem quickly, but the company field remains null, so I have to add it manually, and the soluton of Salman, solved the problem by adding the code "default = lambda self: self.env.user .company_id "to the function fleetvehicule inherit; and everything is consistent now.

thank you Salman and Niyas

Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 3 18
3618
2
thg 2 19
3695
0
thg 4 25
897
creation of company Đã xử lý
1
thg 10 24
12766
0
thg 10 22
2530