1

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

PseudoWithK
  • 321
  • 1
  • 19

2 Answers2

0

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

Baiju KS
  • 659
  • 8
  • 12
  • That would lead to the same problem which was named in the question already: "but it doesn't call other write and create method() from all other modules". So the question is "how to remove ONE link in the super call chain?". – CZoellner Apr 06 '22 at 16:06
  • Yes thank you, I already tried but it did not solve my problem – PseudoWithK Apr 07 '22 at 18:07
0

Try this it work

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