跳至内容
菜单
此问题已终结
2 回复
4731 查看

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


形象
丢弃
最佳答案

Have you tried using env.company?

形象
丢弃
最佳答案

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'))
形象
丢弃
相关帖文 回复 查看 活动
0
9月 22
2470
0
2月 21
2401
1
1月 20
1404
2
3月 24
7849
1
12月 21
5517