Odoo Help

0
4 Answers
1
Salman Hichri
4/15/19, 7:09 AM

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


1 Comment
wajih baghdadi
4/15/19, 4:19 PM

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

1
Avatar

Niyas Raphy

--Niyas Raphy--
14421
| 6 6 9
Calicut, India
--Niyas Raphy--

Odoo Techno Functionalist

Feel free to connect :  niyasraphyk@gmail.com

Twitter:https://twitter.com/niyasraphy
LinkedIn: https://www.linkedin.com/in/niyasraphy/
FB:https://www.facebook.com/niyasraphy123

Happy to help :)

Niyas Raphy
4/15/19, 10:35 AM

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

1 Comment
wajih baghdadi
4/15/19, 4:16 PM

thank you Niyas, great solution

0
wajih baghdadi
4/15/19, 7:57 AM

okay, where to put it , here a screenshot

2 Comments
Salman Hichri
4/15/19, 8:20 AM

you should write it on code

wajih baghdadi
4/16/19, 9:50 AM

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

Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now