Odoo Help

0

0
4 Answers
1
Salman Hichri
15/4/19 07: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/19 16:19

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

1
Avatar

Niyas Raphy

--Niyas Raphy--
15198
| 7 6 11
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
15/4/19 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/19 16:16

thank you Niyas, great solution

0
wajih baghdadi
15/4/19 07:57

okay, where to put it , here a screenshot

2 Comments
Salman Hichri
15/4/19 08:20

you should write it on code

wajih baghdadi
16/4/19 09: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