Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
4706 Zobrazení

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


Avatar
Zrušit
Nejlepší odpověď

Have you tried using env.company?

Avatar
Zrušit
Nejlepší odpověď

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'))
Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
zář 22
2457
0
úno 21
2398
1
led 20
1404
2
bře 24
7836
1
pro 21
5517