hey i am adding a custom field in survey.page which will add all the values of a specific custom field form survey.question. For this i am creating a new addon. Now the problem is that i need to add the field in survey.page so i have to inherit it but i also want the function to run every time so i need @api.depends too and for that i need to inherit survey.question too. But inheriting two of them together is not working as it requires _name and by keeping the same _name as _inherit still wont get overridden. Kindly help. Here is the code
class MyNewModel(models.Model):
_inherit = ['survey.page','survey.question']
survey_score = fields.Integer(string='Total Score',compute='_compute_total_score',store=True)
@api.depends('total_marks')
@api.one
def _compute_total_score(self):
records = self.env["survey.question"].search([('page_id', '=', self.id)])
self.survey_score = sum(records.mapped('total_marks'))