Commit 7dc1e095 by aagusti

Penambahan report pertanyaan

1 parent 1f06a471
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
'security/account_security.xml', 'security/account_security.xml',
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'security/ir_rule.xml', 'security/ir_rule.xml',
'report/question_report.xml',
'views/menus.xml', 'views/menus.xml',
'views/etq_exam.xml', 'views/etq_exam.xml',
'views/etq_results.xml', 'views/etq_results.xml',
......
...@@ -56,6 +56,10 @@ class EtqExam(models.Model): ...@@ -56,6 +56,10 @@ class EtqExam(models.Model):
rec.slug = slug rec.slug = slug
def action_print_question(self):
return self.env.ref(
'exam_test_quiz.report_question_action').report_action(self)
class EtqQuestion(models.Model): class EtqQuestion(models.Model):
_name = "etq.question" _name = "etq.question"
......
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="exam_question_repot">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="exam">
<t t-call="web.external_layout">
<div class="page">
<h2>
<span t-field="exam.name"/>
</h2>
<t t-set="foo" t-value="0"/>
<t t-foreach="exam.questions" t-as="question">
<h4>
<t t-esc="question_index+1"/>)
<t t-raw="question.question.replace('&lt;p&gt;','').replace('&lt;/p&gt;','')"/>
</h4>
<t t-foreach="question.question_options" t-as="answers">
<t t-if="answers.correct==True">
<b>
<span t-field="answers.option"/>
</b>
</t>
<t t-if="answers.correct==False">
<span t-field="answers.option"/>
</t>
<br/>
</t>
<br/>
</t>
</div>
</t>
</t>
</t>
</template>
</data>
</odoo>
...@@ -39,7 +39,10 @@ ...@@ -39,7 +39,10 @@
<field name="name"/> <field name="name"/>
</h1> </h1>
<button name="view_quiz" type="object" string="View Exam"/> <button name="view_quiz" type="object" string="View Exam"/>
<!-- <button name="(action_question_report)d" type="action" string="View Docs"/>-->
<button type='action' name='%(etq_exam_share_action)d' string="Share Exam"/> <button type='action' name='%(etq_exam_share_action)d' string="Share Exam"/>
<button type="object" name="action_print_question" string="Print Question"
class="oe_highlight"/>
</div> </div>
<group> <group>
<field name="show_correct_questions"/> <field name="show_correct_questions"/>
...@@ -120,5 +123,27 @@ ...@@ -120,5 +123,27 @@
<menuitem id="etq_exams" name="Exams" parent="etq_exam" action="etq_exam_action" <menuitem id="etq_exams" name="Exams" parent="etq_exam" action="etq_exam_action"
sequence="20"/> sequence="20"/>
<record id="report_question_action" model="ir.actions.report">
<field name="name">Question List</field>
<field name="model">etq.exam</field>
<field name="report_type">qweb-html</field>
<field name="report_name">exam_test_quiz.exam_question_repot</field>
<field name="report_file">exam_test_quiz.question_repot</field>
<field name="print_report_name">'Session - %s' % (object.name)</field>
<field name="binding_model_id" ref="model_etq_exam"/>
<field name="binding_view_types">form</field>
</record>
<!-- <record id="action_question_report" model="ir.actions.report">-->
<!-- <field name="name">Question Report</field>-->
<!-- <field name="model">etq.question</field>-->
<!-- <field name="report_type">qweb-html</field>-->
<!-- <field name="report_name">exam_test_quiz.exam_question_repot</field>-->
<!-- <field name="report_file">exam_test_quiz.question_repot</field>-->
<!-- <field name="print_report_name">'Question Report - %s' % (object.name)</field>-->
<!-- <field name="binding_model_id" ref="model_etq_question"/>-->
<!-- <field name="binding_type">report</field>-->
<!-- </record>-->
</data> </data>
</odoo> </odoo>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!