Odoo Help

0

0
4 Answers
1
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;)

1
Avatar

Niyas Raphy

--Niyas Raphy--
15198
| 7 6 11
Calicut, الهند
--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
15‏/4‏/2019 10:35 ص

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

thank you Niyas, great solution

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

okay, where to put it , here a screenshot

2 Comments
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.

Register
Odoo Training Center

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

Test it now