I want to take current active model name from URL in though JS code.Is there any other way?
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
You can use 'window.location.href' to get the current browser url.See my below code and you can get the current model name by splitting the string in JS.
// http://localhost:1287/web?db=mar_12#id=3&action=211&model=account.invoice&view_type=form&menu_id=88
var current_url = window.location.href;
var myArray = current_url.split("&");
var current_model = myArray[2].replace('model=',''); // model=account.invoice
Hope it will be useful for you.
You can get current url using location.href and can get the current model using state data
this.state.model --- view renderer provide the model data and its context in state parameter.
So instead of splitting the URL to get the model name you can take the benefit of widget data.
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
DaftarPost Terkait | Replies | Tampilan | Aktivitas | |
---|---|---|---|---|
|
0
Des 20
|
3788 | ||
|
2
Jul 25
|
3310 | ||
|
2
Jul 25
|
3022 | ||
|
2
Jun 25
|
1811 | ||
|
0
Mei 25
|
14 |
@Nivas. Thanks it works now.