Skip to Content
Menu
This question has been flagged
1 Reply
13926 Views

i want to do some operation while deleting multiple records at a time in odoo using unlink()..please suggest

Avatar
Discard
Best Answer

Hello Nikunja Maharana,

For Overriding the unlink method, please refer to this link
Link: https://www.odoo.com/forum/help-1/question/how-to-override-only-the-unlink-method-of-account-invoice-class-73910

Make sure before you need to inherit the function or override.

I hope maybe inherit is enough for your case.

If you are overriding the original method rather than extending it, then you can avoid inheriting it and go with overriding.

Anyway for inheriting check this code:

@api.multi
def unlink(self):
# "your code"
return super(YourClass, self).unlink()

In both cases, you can check self contains multiple records or not.


Thanks & Regards

Avinash N K

Avatar
Discard

Heads-up for people using Odoo V14/V15: you no longer can/should use the @api.multi as it has been removed from the API's. Simply remove the @api.multi annotation.

Related Posts Replies Views Activity
2
Dec 23
11993
0
Oct 23
33
3
Oct 23
787
1
Oct 23
569
1
Aug 23
979