Odoo modules related to surveys
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
8.2 KiB

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <data>
  4. <template id="matrix_custom" inherit_id="survey.matrix">
  5. <xpath expr="//table" position="replace">
  6. <table class="table table-hover">
  7. <thead>
  8. <tr>
  9. <th> </th>
  10. <th t-foreach="question.labels_ids" t-as="col_label"><span t-field="col_label.value" /></th>
  11. </tr>
  12. </thead>
  13. <tbody>
  14. <tr t-foreach="question.labels_ids_2" t-as="row_label">
  15. <th><span t-field="row_label.value" /></th>
  16. <td t-foreach="question.labels_ids" t-as="col_label">
  17. <input t-if="question.matrix_subtype == 'simple'" type="radio" t-att-name="'%s_%s' % (prefix, row_label.id)" t-att-value='col_label.id' />
  18. <t t-if="question.matrix_subtype == 'custom_row'">
  19. <t t-if="col_label.type == 'textbox'">
  20. <input type="text" class="form-control" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)"/>
  21. </t>
  22. <t t-if="col_label.type == 'free_text'">
  23. <textarea class="form-control" rows="3" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)"></textarea>
  24. </t>
  25. <t t-if="col_label.type == 'numerical_box'">
  26. <input type="number" step="any" class="form-control" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)"/>
  27. </t>
  28. <t t-if="col_label.type == 'date'">
  29. <div class='input-group date'>
  30. <input type="text" date="true" class="form-control date" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)"/>
  31. </div>
  32. </t>
  33. <t t-if="col_label.type == 'dropdown'">
  34. <select t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)" class="form-control" id="seldpbox1">
  35. <option></option>
  36. <t t-foreach="col_label.dpvalues" t-as="dpv">
  37. <option t-att-value="dpv.id"><t t-esc="dpv.name"/></option>
  38. </t>
  39. </select>
  40. </t>
  41. <t t-if="col_label.type == 'checkbox'">
  42. <input type="checkbox" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)" t-att-value='col_label.id' />
  43. </t>
  44. </t>
  45. <input t-if="question.matrix_subtype == 'multiple'" type="checkbox" t-att-name="'%s_%s_%s' % (prefix, row_label.id, col_label.id)" t-att-value='col_label.id' />
  46. </td>
  47. </tr>
  48. </tbody>
  49. </table>
  50. </xpath>
  51. </template>
  52. <template id="report_survey_answers_document">
  53. <t t-call="web.internal_layout">
  54. <t t-set="doc" t-value="doc.with_context({'lang':doc.partner_id.lang})" />
  55. <div class="page">
  56. <div class="oe_structure"/>
  57. <div class="row mt32 mb32" style="display: inherit;">
  58. <h3 class="text-center"><t t-esc="doc.survey_id.title"/></h3>
  59. <t t-set="questions" t-value="doc.user_input_line_ids.mapped('question_id')"/>
  60. <!-- <h3 class="text-center"><t t-esc="doc."/></h3> -->
  61. <t t-foreach="questions" t-as="qs">
  62. <t t-if="qs.matrix_subtype == 'custom_row'">
  63. <h4 class="text-center mt16 mb16" t-field="qs.question"/>
  64. <table class="table" style="width:100%;">
  65. <thead>
  66. <tr style="width:100%;text-align: center">
  67. <th style="text-align: center">#</th>
  68. <t t-foreach="qs.labels_ids" t-as="lb">
  69. <th style="text-align: center"> <span t-field="lb.value"/></th>
  70. </t>
  71. </tr>
  72. </thead>
  73. <tbody>
  74. <t t-foreach="qs.labels_ids_2" t-as="lb2">
  75. <tr style="text-align: center">
  76. <td style="text-align: center"><strong t-field="lb2.value"></strong></td>
  77. <t t-foreach="qs.labels_ids" t-as="lb">
  78. <t t-set="flag" t-value="false"/>
  79. <t t-foreach="doc.user_input_line_ids" t-as="ans">
  80. <t t-if="ans.value_suggested_row.id == lb2.id">
  81. <t t-if="ans.value_suggested.id == lb.id">
  82. <td class="text-center">
  83. <t t-if="ans.answer_type == 'text'">
  84. <span t-field="ans.value_text"/>
  85. </t>
  86. <t t-if="ans.answer_type == 'number'">
  87. <span t-field="ans.value_number"/>
  88. </t>
  89. <t t-if="ans.answer_type == 'free_text'">
  90. <span t-field="ans.value_free_text"/>
  91. </t>
  92. <t t-if="ans.answer_type == 'suggestion'">
  93. <span class="fa fa-check"/>
  94. </t>
  95. <t t-if="ans.answer_type == 'dropdown'">
  96. <span t-field="ans.value_dropdown"/>
  97. </t>
  98. </td>
  99. <t t-set="flag" t-value="true"/>
  100. </t>
  101. </t>
  102. </t>
  103. <t t-if="not flag">
  104. <td style="text-align: center">
  105. </td>
  106. </t>
  107. </t>
  108. </tr>
  109. </t>
  110. </tbody>
  111. </table>
  112. </t>
  113. </t>
  114. </div>
  115. </div>
  116. </t>
  117. </template>
  118. <template id="report_survey_answers">
  119. <t t-call="web.html_container">
  120. <t t-foreach="docs" t-as="doc">
  121. <t t-call="custom_matrix_survey.report_survey_answers_document"/>
  122. </t>
  123. </t>
  124. </template>
  125. </data>
  126. </odoo>