add survey_score_ranges: displays different messages depending on the score obtained, allowing different score ranges
This commit is contained in:
parent
9cabf044c8
commit
4d1eaebc06
11 changed files with 269 additions and 1 deletions
50
survey_score_ranges/views/survey_score_range_views.xml
Normal file
50
survey_score_ranges/views/survey_score_range_views.xml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_survey_score_range_tree" model="ir.ui.view">
|
||||
<field name="name">survey.score.range.tree</field>
|
||||
<field name="model">survey.score.range</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="survey_id"/>
|
||||
<field name="min_score"/>
|
||||
<field name="max_score"/>
|
||||
<field name="no_upper_limit"/>
|
||||
<field name="active"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_survey_score_range_form" model="ir.ui.view">
|
||||
<field name="name">survey.score.range.form</field>
|
||||
<field name="model">survey.score.range</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Score Range">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="survey_id"/>
|
||||
<field name="min_score"/>
|
||||
<field name="no_upper_limit"/>
|
||||
<field name="max_score" invisible="no_upper_limit"/>
|
||||
<field name="active"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Result Content">
|
||||
<field name="result_html" widget="html"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_survey_score_range" model="ir.actions.act_window">
|
||||
<field name="name">Score Ranges</field>
|
||||
<field name="res_model">survey.score.range</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_survey_score_range_root" name="Score Ranges" parent="survey.menu_surveys" action="action_survey_score_range" sequence="60" groups="base.group_user"/>
|
||||
</odoo>
|
||||
42
survey_score_ranges/views/survey_survey_views.xml
Normal file
42
survey_score_ranges/views/survey_survey_views.xml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_survey_survey_form_inherit_score_ranges" model="ir.ui.view">
|
||||
<field name="name">survey.survey.form.score.ranges</field>
|
||||
<field name="model">survey.survey</field>
|
||||
<field name="inherit_id" ref="survey.survey_survey_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//sheet/notebook" position="inside">
|
||||
<page string="Score Ranges" invisible='not scoring_type'>
|
||||
<group>
|
||||
<field name="enable_score_ranges"/>
|
||||
</group>
|
||||
<group invisible="not enable_score_ranges" col="1">
|
||||
<field name="score_range_ids" context="{'default_survey_id': active_id}" nolabel="1">
|
||||
<tree editable="bottom">
|
||||
<field name="name"/>
|
||||
<field name="min_score"/>
|
||||
<field name="no_upper_limit"/>
|
||||
<field name="max_score" invisible="no_upper_limit"/>
|
||||
<field name="active"/>
|
||||
</tree>
|
||||
<!-- <form string="Score Range">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="min_score"/>
|
||||
<field name="no_upper_limit"/>
|
||||
<field name="max_score" invisible="no_upper_limit"/>
|
||||
<field name="active"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="result_html" widget="html"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form> -->
|
||||
</field>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
13
survey_score_ranges/views/survey_templates.xml
Normal file
13
survey_score_ranges/views/survey_templates.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!-- Inherit finished template to inject range result -->
|
||||
<template id="survey_fill_form_done_inherit_score_ranges" inherit_id="survey.survey_fill_form_done">
|
||||
<xpath expr="//div[@class='o_survey_finished mt32 mb32']/div[@class='row']/div[@class='col']" position="inside">
|
||||
<t t-if="survey.enable_score_ranges and answer.result_range_html">
|
||||
<div class="o_survey_score_range_result mt-3">
|
||||
<t t-raw="answer.result_range_html"/>
|
||||
</div>
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue