'Odoo - Override a specific write and create method

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



Solution 1:[1]

Instead of using super() you can use models.Model.create().

Please remove this from the code

moves = super(AccountMove, self).create(vals_list)

and Add this

return models.Model.create(self, vals_list)

check this link

Solution 2:[2]

Try this it work

@api.model
def create(self, vals):
        #code...............
        return super().create(vals)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Baiju KS
Solution 2 Mayank Vachhani