Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
4625 Widoki

Odoo 13e:

I have a form view and I want to show or hide fields based on what company the user is currently viewing the form as.  (See screenshot)

Meaning, if they change which company in the dropdown, we would know.

I've tried so many methods to get it, but I keep ending up with the user's default company_id or something else.


I'm specifically extending sale.view_order_form


Awatar
Odrzuć
Najlepsza odpowiedź

Have you tried using env.company?

Awatar
Odrzuć
Najlepsza odpowiedź

Avatar
Zbik
Best Answer

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'))
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
wrz 22
2215
0
lut 21
2218
1
sty 20
1404
2
mar 24
7670
1
gru 21
5399