跳至內容
選單
此問題已被標幟
2 回覆
4615 瀏覽次數

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
2189
0
2月 21
2211
1
1月 20
1404
2
3月 24
7634
1
12月 21
5396