In any python method How can I know the current view id
when I use an inherited form
or just the original form
can any one help me in this ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Akuntansi
- Inventaris
- PoS
- Project
- MRP
Pertanyaan ini telah diberikan tanda
Hi Ahmed,
Try this code :
def your_method_name(self):
view_id = self.env.context.get('view_id')
if view_id:
original_view = self.env['ir.ui.view'].browse(view_id)
unfortunately, not working every time the view_id came with None value.
any thing can I add it in the view xml to get value for the view_id ??
Hi Ahmed,
Can you try this one.
@api.model
def custom_method(self):
params = self.env.context.get('params', {})
view_id = params.get('view_id')
if view_id:
view = self.env['ir.ui.view'].browse(view_id)
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
DaftarPost Terkait | Replies | Tampilan | Aktivitas | |
---|---|---|---|---|
|
2
Des 24
|
2658 | ||
|
0
Sep 24
|
715 | ||
|
0
Mei 24
|
1576 | ||
|
1
Mei 25
|
1123 | ||
Prevent Lead/CRM Duplicates
Diselesaikan
|
|
3
Mei 25
|
799 |