If the user changed the company from the top bar dropdown. I want to run a function. Can I know how to detect company changed or not in the environment?
I am using Odoo 13 enterprise
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
If the user changed the company from the top bar dropdown. I want to run a function. Can I know how to detect company changed or not in the environment?
I am using Odoo 13 enterprise
Hello Sandaruwan
yes you can if any user change the company from the drop-down
then there is one JS method called setCompanies() in web/static/src/js/core/session.js
you can inherit that method and include your code
setCompanies: function (main_company_id, company_ids) {
var hash = $.bbq.getState()
hash.cids = company_ids.sort(function(a, b) {
if (a === main_company_id) {
return -1;
} else if (b === main_company_id) {
return 1;
} else {
return a - b;
}
}).join(',');
utils.set_cookie('cids', hash.cids || String(main_company_id));
$.bbq.pushState({'cids': hash.cids}, 0);
####write your code here####
location.reload();
},
Best Regards,
Bhavesh Jadav
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
0
ก.ค. 23
|
2266 | ||
|
2
เม.ย. 21
|
4836 | ||
|
1
ก.ค. 20
|
2688 | ||
|
0
ก.พ. 23
|
3842 | ||
How To Calculate Age From Birthday
แก้ไขแล้ว
|
|
7
ก.ย. 21
|
28191 |