Skip to content Skip to sidebar Skip to footer

How Can Override Write Method Without Executing The Super Write?

In the membership.py file the class account_invoice_line which inherits 'account.invoice.line' and overrides the write method which will create a new member line when a new line o

Solution 1:

you can bypass calling of super method as like below.

Instead of your class name you need to pass osv.osv class to call direct base write method.

res = super(osv.osv, self).write(cr, uid, ids, vals, context=context)

It will bypass the all super write method and directly called of osv.osv class.

Note: You can also call any other class instead of osv.osv. For that you have to follow as like below.

for ex.

from openerp.addons.account.account_invoice import account_invoice


classaccount_invoice_inherit(osv.osv):
defwrite( . .. . )

    res = super(account_invoice,self).write(. .. .)

    . .. .

    return res

Here from this class system will called directly write method of account_invoice class.

I hope it will help you.

Post a Comment for "How Can Override Write Method Without Executing The Super Write?"