Odoo Help


4 Answers
Salman Hichri
15‏/4‏/2019 7:09 ص

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
15‏/4‏/2019 4:19 م

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


Niyas Raphy

--Niyas Raphy--
| 7 6 11
Calicut, الهند
--Niyas Raphy--

Odoo Techno Functionalist

Feel free to connect :  niyasraphyk@gmail.com

LinkedIn: https://www.linkedin.com/in/niyasraphy/

Happy to help :)

Niyas Raphy
15‏/4‏/2019 10:35 ص


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.


1 Comment
wajih baghdadi
15‏/4‏/2019 4:16 م

thank you Niyas, great solution

wajih baghdadi
15‏/4‏/2019 7:57 ص

okay, where to put it , here a screenshot

Salman Hichri
15‏/4‏/2019 8:20 ص

you should write it on code

wajih baghdadi
16‏/4‏/2019 9:50 ص

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.

Odoo Training Center

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

Test it now