Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4646 มุมมอง

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'))
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.ย. 22
2228
0
ก.พ. 21
2225
1
ม.ค. 20
1404
2
มี.ค. 24
7688
1
ธ.ค. 21
5419