Skip to Content
Menu
This question has been flagged
1736 Views

Hey i am trying to make a tree view from sql query and it gives this strange error mentioned in the title. I dont have any column named active in my model or query. Can anyone please tell what it is , looking forward you all. Thanks in advance

class ReportSQL(models.Model):
_name = 'survey.report'
_description = 'Survey Report'
_rec_name = 'title'
_inherit = ['survey.user_input','survey.survey']
_auto = False
value = fields.Char('Suggested value', translate=True, required=True)
total_mark = fields.Float('Score for this choice',
help="A positive score indicates a correct choice; a negative or null score indicates a wrong answer")
question_id = fields.Many2one('survey.question', string='Question', ondelete='cascade', store=True)
survey_id = fields.Many2one('survey.survey', string='Survey', required=True, readonly=True, ondelete='restrict')
obtain_mark = fields.Float('Score given for this choice')
title = fields.Char('Title', required=True, translate=True)
partner_id = fields.Many2one('res.partner', string='Partner', readonly=True)
date_create = fields.Datetime('Creation Date', default=fields.Datetime.now, required=True, readonly=True,
copy=False)
name = fields.Char('Partner Name')

@api.model_cr
def init(self):
print("Connected")
tools.drop_view_if_exists(self._cr, 'survey_report')
self._cr.execute(""" CREATE VIEW public.survey_report AS (
SELECT min(a.question_id) AS id,
a.value AS value,
a.quizz_mark AS total_mark,
b.quizz_mark as obtain_mark,
b.survey_id as survey_id,
c.title as title,
d.partner_id as partner_id,
d.date_create as date_create,
e.name as name

from public.survey_label as a
Inner Join public.survey_user_input_line as b
on a.question_id = b.question_id

Inner Join public.survey_survey as c
on b.survey_id = c.id

Inner Join public.survey_user_input as d
on d.survey_id = b.survey_id

Inner Join public.res_partner as e
on e.id = d.partner_id
where a.quizz_mark != '0'

GROUP BY a.question_id, a.value, a.quizz_mark, b.quizz_mark, b.survey_id, c.title, d.partner_id, d.date_create, e.namex

)"""
)
Avatar
Discard