Hello community,
I have a problem with the overload of the create() and write() methods.
Let me explain.
My custom module inherits from a custom module in which I have no rights to modify the code. These 2 modules overload the create and write methods. On the other hand, I don't like the custom module overloads. So I want to override these method overloads so that my new overloads in my custom module are taken into account. How can I do it?
I tried not to call super(), it works but it doesn't call other write and create method() from all other modules. Do you have any idea please? thank you in advance
This question has been flagged
2
Replies
3629
Views
Here you can use monkey patch.
For more information please check this discussion.
Hello
You can do something like this:
from odoo.addons.stock.models.stock_picking import Picking
def button_validate(self):
#your code
return
Picking.button_validate = button_validate
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up| Related Posts | Replies | Views | Activity | |
|---|---|---|---|---|
|
|
1
Jun 26
|
1054 | ||
|
|
0
Jun 26
|
21 | ||
|
|
0
Jun 26
|
7 | ||
|
|
0
Jun 26
|
8 | ||
|
|
0
Jun 26
|
4 |
You can skip all the models and call the base Model
BaseMetaModel = self.env.registry['base']
super(BaseMetaModel, self).create(values)
I can't post an answer, anyone knows why?