[IMP] survey: use default filter instead of different action

When accessing answers (survey.user_input) through the survey form view, we used a separate action
to hide the test entries.

This could be confusing when you actually wanted to see the test entries for that survey.

This commit changes that to use a default filter instead, leading to the same visual behavior.

Task #2058598

closes odoo/odoo#36835

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Aurélien Warnon
2019-09-13 11:29:13 +00:00
parent 4e712fc2f9
commit 4e39a89944
2 changed files with 11 additions and 20 deletions
+9 -6
View File
@@ -475,28 +475,31 @@ class Survey(models.Model):
}
def action_survey_user_input_completed(self):
action_rec = self.env.ref('survey.action_survey_user_input_notest')
action_rec = self.env.ref('survey.action_survey_user_input')
action = action_rec.read()[0]
ctx = dict(self.env.context)
ctx.update({'search_default_survey_id': self.ids[0],
'search_default_completed': 1})
'search_default_completed': 1,
'search_default_not_test': 1})
action['context'] = ctx
return action
def action_survey_user_input_certified(self):
action_rec = self.env.ref('survey.action_survey_user_input_notest')
action_rec = self.env.ref('survey.action_survey_user_input')
action = action_rec.read()[0]
ctx = dict(self.env.context)
ctx.update({'search_default_survey_id': self.ids[0],
'search_default_quizz_passed': 1})
'search_default_quizz_passed': 1,
'search_default_not_test': 1})
action['context'] = ctx
return action
def action_survey_user_input(self):
action_rec = self.env.ref('survey.action_survey_user_input_notest')
action_rec = self.env.ref('survey.action_survey_user_input')
action = action_rec.read()[0]
ctx = dict(self.env.context)
ctx.update({'search_default_survey_id': self.ids[0]})
ctx.update({'search_default_survey_id': self.ids[0],
'search_default_not_test': 1})
action['context'] = ctx
return action
+2 -14
View File
@@ -17,7 +17,9 @@
<filter string="Invite" name="invite" domain="[('input_type', '=', 'link')]"/>
<separator/>
<filter string="Quizz passed" name="quizz_passed" domain="[('quizz_passed','=', True)]"/>
<separator/>
<filter string="Test Entries" name="test" domain="[('test_entry','=', True)]"/>
<filter string="Except Test Entries" name="not_test" domain="[('test_entry','=', False)]" invisible="1"/>
<group expand="0" string="Group By">
<filter name="group_by_survey" string="Survey" domain="[]" context="{'group_by': 'survey_id'}"/>
<filter string="Email" name="group_by_email" domain="[]" context="{'group_by': 'email'}"/>
@@ -149,20 +151,6 @@
</p>
</field>
</record>
<record model="ir.actions.act_window" id="action_survey_user_input_notest">
<field name="name">Participations</field>
<field name="res_model">survey.user_input</field>
<field name="view_mode">tree,kanban,form</field>
<field name="view_id" ref="survey_user_input_view_tree"></field>
<field name="search_view_id" ref="survey_user_input_view_search"/>
<field name="context">{'search_default_group_by_survey': True}</field>
<field name="domain">[('test_entry', '=', False)]</field>
<field name="help" type="html">
<p class="o_view_nocontent_empty_folder">
Nobody has replied to your surveys yet
</p>
</field>
</record>
<!-- USER INPUT LINES
.. note:: these views are useful mainly for technical users/administrators -->