Affichage de la liste des réponses pour une question données en vue Kanban (youpi)
authorAlicia FLOREZ <alicflorez@gmail.com>
Wed, 15 May 2013 15:13:27 +0000 (17:13 +0200)
committerAlicia FLOREZ <alicflorez@gmail.com>
Wed, 15 May 2013 15:13:27 +0000 (17:13 +0200)
demo/faq.xml
faq.py
views/faq_view.xml

index 257f63f..2c2cdc3 100644 (file)
@@ -20,7 +20,7 @@
 
         <record id="quest1" model="faq.question">
             <field name="name">Comment bien programmer ?</field>
-            <field name="description">la phylosophie python</field>
+            <field name="description">La phylosophie python</field>
             <field name="theme_id" ref="theme1"/>
         </record>
 
diff --git a/faq.py b/faq.py
index 0c8a268..ed1ad8c 100644 (file)
--- a/faq.py
+++ b/faq.py
@@ -18,7 +18,7 @@ class question(osv.Model):
         result={}
         for question in self.browse(cr, uid, ids, context=context):
             res=[]
-            for answer in question.aswers:
+            for answer in question.answers:
                 res.append({'id': answer.id, 'name': answer.name})
             result[question.id] = res
         return result
@@ -28,7 +28,7 @@ class question(osv.Model):
         "description": fields.text(string="Description"),
         "theme_id": fields.many2one("faq.theme", string="Theme", required=True),
         "answers": fields.one2many("faq.answer" , "question_id", string="Answers"),
-        "answer_items": fields.function(_answer_items, string="Answer items")
+        "answer_items": fields.function(_answer_items, type="text", string="Answer items"),
     }
 
 class answer(osv.Model):
index 44f64ed..e71d8d3 100644 (file)
                                     <t t-esc="record.description.value" />
 
                                     <h4>Questions</h4>
-                                    <t t-foreach="record.questions.raw_value" t-as="question">
-                                        <p><t t-call="kanban-question" /></p>
-                                    </t>
-
-                                    <p>Domain: <t t-esc="record.questions.domain" /></p>
-                                    <p>String: <t t-esc="record.questions.string" /></p>
-                                    <p>Views: <t t-esc="record.questions.views" /></p>
-                                    <p>Relation: <t t-esc="record.questions.relation" /></p>
-                                    <p>Context: <t t-esc="record.questions.context" /></p>
-                                    <p>Relation_field: <t t-esc="record.questions.relation_field" /></p>
-                                    <p>Selectable: <t t-esc="record.questions.selectable" /></p>
-                                    <p>Type: <t t-esc="record.questions.type" /></p>
-                                    <p>Value: <t t-esc="record.questions.value" /></p>
-                                    <p>Raw_value: <t t-esc="record.questions.raw_value" /></p>
 
                                 </div>
 
 
                                 <div t-attf-class="oe_kanban_content">
                                     <h2><field name="name" /></h2>
-                                    <h4>Description</h4>
+                                    <h4>Question</h4>
                                     <field name="description" />
-                                    <field name="answers">
-                                        <tree string="Machin">
-                                            <field name="name" />
-                                        </tree>
-                                    </field>
-                                    <h4>Tests</h4>
-                                    <p>Domain: <t t-esc="record.answers.domain" />(<t t-esc="typeof record.answers.domain" />)</p>
-                                    <p>String: <t t-esc="record.answers.string" />(<t t-esc="typeof record.answers.string" />)</p>
-                                    <p>Views: <t t-esc="record.answers.views" />(<t t-esc="typeof record.answers.views" />)</p>
-                                    <p>Relation: <t t-esc="record.answers.relation" />(<t t-esc="typeof record.answers.relation" />)</p>
-                                    <p>Context: <t t-esc="record.answers.context" />(<t t-esc="typeof record.answers.context" />)</p>
-                                    <p>Relation_field: <t t-esc="record.answers.relation_field" />(<t t-esc="typeof record.answers.relation_field" />)</p>
-                                    <p>Selectable: <t t-esc="record.answers.selectable" />(<t t-esc="typeof record.answers.selectable" />)</p>
-                                    <p>Type: <t t-esc="record.answers.type" />(<t t-esc="typeof record.answers.type" />)</p>
-                                    <p>Value: <t t-esc="record.answers.value" />(<t t-esc="typeof record.answers.value" />)</p>
-                                    <p>Raw_value: <t t-esc="record.answers.raw_value" />(<t t-esc="typeof record.answers.raw_value" />)</p>
-
-                                    <p>View 0: <t t-esc="record.answers.views[0]" /></p>
-                                    <p>Context 0: <t t-esc="record.answers.context[0]" /></p>
+                                    <field name="answer_items" invisible="1" />
 
                                     <h4>Réponses</h4>
-                                    <ul t-name="Answers">
-                                        <li t-foreach="record.answers.raw_value" t-as="answer">
-                                            <span class="oe_tag" t-att-data-answer="answer"></span><!--
-                                            <t t-esc="answer"/>(<t t-esc="typeof answer"/>)
-                                            <t t-esc="kanban_image('faq.anwser', 'name', answer)"/>
-                                            11<t t-esc="answer.name"/>
-                                            12<t t-esc="answer[name]"/>
-                                            13<t t-esc="answer['name']"/>
-                                            14<t t-esc="answer.name.value"/>
-                                            15<t t-esc="answer[name].value"/>
-                                            16<t t-esc="answer['name'].value"/>
-                                            <t t-call="example_template.sub">
-                                                <t t-set="arg" t-value="answer_value"/>
-                                            </t>-->
+
+                                    <ul t-if="record.answer_items.value">
+                                        <li t-foreach="record.answer_items.value" t-as="answer" t-att-class="answer_parity">
+                                            <t t-call="answer_template.sub">
+                                                <t t-set="title" t-value="answer.name"/>
+                                                <t t-set="id" t-value="answer.id"/>
+                                            </t>
                                         </li>
                                     </ul>
-                                </div>
 
+                                    <p t-if="record.answer_items.value == ''">Pas de réponse pour l'instant.</p>
+
+                                </div>
                             </div>
                         </t>
-                            <t t-name="example_template.sub">
-                                21<t t-esc="arg.name"/>
-                                22<t t-esc="arg[name]"/>
-                                23<t t-esc="arg['name']"/><!--
-                                24<t t-esc="arg.name.value"/>
-                                25<t t-esc="arg[name].value"/>
-                                26<t t-esc="arg['name'].value"/>-->
-                            </t>
+                        <t t-name="answer_template.sub">
+                            <p><t t-esc="title"/> (ID : <t t-esc="id"/>)</p>
+                        </t>
                     </templates>
                 </kanban>
             </field>