跳至内容
菜单
此问题已终结
4 回复
3664 查看

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

形象
丢弃
最佳答案

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


形象
丢弃
编写者

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

最佳答案

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

形象
丢弃
编写者

thank you Niyas, great solution

编写者 最佳答案

okay, where to put it , here a screenshot

形象
丢弃

you should write it on code

编写者

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

相关帖文 回复 查看 活动
4
3月 18
3525
2
2月 19
3619
0
4月 25
782
1
10月 24
12606
0
10月 22
2346