I need to override a patch from a module that is part of the Enterprise edition. In this case, I only need to modify the patch of a method in JavaScript, but I don't see a way to modify just that patch without affecting the entire functionality. Is there a way to override or unpatch a specific patch? Or is there any workaround for 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
Hello Vicente de Orue,
In Odoo 17-18 we cannot unpatch a method, but we can override an existing patch from another module.
The patch() utility simply extends or replaces methods on the prototype, so to change an already patched method you just redefine it and optionally call the original one.
Here's a simple example showing how to override with the existing patch:
const oldMethod = Target.prototype.methodName;
patch(Target.prototype, "my_module", {
methodName() {
// your custom logic here
return oldMethod.call(this, ...arguments);
},
});
If you have any questions, feel free to reach out to us
Hope this helps!
Thanks & Regards,
Email : odoo@aktivsoftware.com
Hi,
Please refer to the links:
1. https://www.cybrosys.com/blog/how-to-patch-existing-owl-components-in-odoo-18
2. https://www.odoo.com/documentation/18.0/developer/reference/frontend/patching_code.html
Hope it helps.
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
Jul 25
|
783 | ||
|
2
Jul 25
|
1732 | ||
|
1
Nov 24
|
1728 | ||
How to add product in POS programmatically
Diselesaikan
|
|
4
Okt 24
|
4277 | |
|
0
Apr 23
|
1972 |
Hello, AFAIK you'd need to patch at least the method of that javascript part of the module