Odoo Help

2

1
3 Answers
2
Artem Russian Federation
10/14/16, 3:01 PM

Using new api: default=lambda self: self.env.user.company_id.id

self.env.user.company_id - recordset

company_id = fields.Many2one - integer=id of another record

4
Avatar

Zbik Poland

--Zbik--
12715
| 7 6 9
Łódź, Poland
--Zbik--


Zbik Poland
12/2/15, 10:48 AM

Try like this:

default=lambda self: self.env['res.company']._company_default_get('your.module')


UPDATED:

probably correct code is slightly different, see https://github.com/odoo/odoo/issues/10906

 default=lambda self: self.env['res.company'].browse(self.env['res.company']._company_default_get('your.module'))

1 Comment
Aron Lorincz Hungary
12/4/15, 11:05 AM

I can confirm it works just great. I'm using it to retrieve the company's default currency.

Ask a Question
Writer
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