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
- Comptabilitat
- Inventari
- PoS
- Project
- MRP
This question has been flagged
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)
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Registrar-seRelated Posts | Respostes | Vistes | Activitat | |
---|---|---|---|---|
|
2
de des. 24
|
2627 | ||
|
0
de set. 24
|
669 | ||
|
0
de maig 24
|
1532 | ||
|
1
de maig 25
|
1072 | ||
Prevent Lead/CRM Duplicates
Solved
|
|
3
de maig 25
|
765 |