There are cases when you need to re-write a method defined in a module (module_A) which already inherits an Odoo module. You want your improvements into a new module (module_B), but you don't want to execute anything from the method in module_A.
History short: Call the super() directly from module_A
from odoo import models, fields, api, _
class HrExpenseFirstInheritance(models.Model):
_inherit = 'hr.expense.expense'
def _search(self, args, offset=0, limit=None, order=None, count=False, access_rights_uid=None):
#Your code here. i.e define new_args
new_args = more_code
#This is the normal call for his parent method
return super(HrExpenseFirstInheritance, self)._search(new_args, offset, limit, order, count=count,
access_rights_uid=access_rights_uid)
from odoo.addons.module_A.models import hr_expense_inheritedA
class HrExpenseExpenseSecondInheritance(models.Model):
_inherit = 'hr.expense.expense'
def _search(self, args, offset=0, limit=None, order=None, count=False, access_rights_uid=None):
#Your new code here. i.e define new_args,completly different from the defined in module_A
new_args = more_code_totally_different
#Call the super in module_A
return super(hr_expense_inheritedA.HrExpenseFirstInheritance, self)._search(new_args, offset, limit, order, count=count,
access_rights_uid=access_rights_uid)