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.

191 lines
7.9 KiB

4 years ago
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <!-- survey views and actions -->
  4. <record id="survey_survey_form" model="ir.ui.view">
  5. <field name="name">survey_template survey.survey form</field>
  6. <field name="model">survey.survey</field>
  7. <field name="inherit_id" ref="survey.survey_form"/>
  8. <field name="priority">22</field>
  9. <field name="arch" type="xml">
  10. <field name="is_closed" position="after">
  11. <field name="is_template" invisible="1"/>
  12. </field>
  13. <!-- Hide send button and stage on templates -->
  14. <button name="action_send_survey" position="attributes">
  15. <attribute name="attrs">{'invisible': [('is_template', '=', True)]}</attribute>
  16. </button>
  17. <field name="stage_id" position="before">
  18. <button type="object" name="create_survey_from_template" string="Create a survey from this template"
  19. attrs="{'invisible':[('is_template','=',False)]}" class="btn btn-warning" icon="fa-copy"/>
  20. </field>
  21. <field name="stage_id" position="attributes">
  22. <attribute name="attrs">{'invisible': [('is_template', '=', True)]}</attribute>
  23. </field>
  24. <div name="button_box" position="after">
  25. <h2 class="badge-pill badge-warning float-right" attrs="{'invisible': [('is_template', '=', False)]}">This survey is a template</h2>
  26. </div>
  27. </field>
  28. </record>
  29. <record id="survey_survey_tree" model="ir.ui.view">
  30. <field name="name">survey_template survey.survey tree</field>
  31. <field name="model">survey.survey</field>
  32. <field name="inherit_id" ref="survey.survey_tree"/>
  33. <field name="priority">22</field>
  34. <field name="arch" type="xml">
  35. <tree position="attributes">
  36. <attribute name="decoration-warning">is_template</attribute>
  37. </tree>
  38. <tree position="inside">
  39. <field name="is_template" invisible="1"/>
  40. </tree>
  41. </field>
  42. </record>
  43. <record id="survey_survey_kanban" model="ir.ui.view">
  44. <field name="name">survey_template survey.survey kanban</field>
  45. <field name="model">survey.survey</field>
  46. <field name="inherit_id" ref="survey.survey_kanban"/>
  47. <field name="priority">22</field>
  48. <field name="arch" type="xml">
  49. <field name="title" position="after">
  50. <field name="is_template"/>
  51. </field>
  52. <xpath expr="//div[hasclass('oe_kanban_bottom_left')]" position="inside">
  53. <div t-if="record.is_template.raw_value" class="badge-pill badge-warning">Template</div>
  54. </xpath>
  55. </field>
  56. </record>
  57. <record id="survey.action_survey_form" model="ir.actions.act_window">
  58. <field name="domain">[('is_template','=',False)]</field>
  59. </record>
  60. <!-- survey template views and actions -->
  61. <record id="survey_survey_template_tree" model="ir.ui.view">
  62. <field name="name">survey_template survey.survey template tree</field>
  63. <field name="model">survey.survey</field>
  64. <field name="priority">22</field>
  65. <field name="arch" type="xml">
  66. <tree decoration-warning="is_template">
  67. <field name="active" invisible="1"/>
  68. <field name="is_template" invisible="1"/>
  69. <field name="title"/>
  70. <button type="object" name="create_survey_from_template" title="Create a survey from this template"
  71. attrs="{'invisible':[('is_template','=',False)]}" icon="fa-copy"/>
  72. </tree>
  73. </field>
  74. </record>
  75. <record id="survey_survey_template_kanban" model="ir.ui.view">
  76. <field name="name">survey_template survey.survey template kanban</field>
  77. <field name="model">survey.survey</field>
  78. <field name="priority">22</field>
  79. <field name="arch" type="xml">
  80. <kanban>
  81. <field name="designed"/>
  82. <field name="title"/>
  83. <field name="is_template"/>
  84. <field name="color"/>
  85. <templates>
  86. <div t-name="kanban-box" t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click">
  87. <div class="o_dropdown_kanban dropdown" t-if="widget.editable">
  88. <a role="button" class="dropdown-toggle o-no-caret btn" data-toggle="dropdown" data-display="static" href="#" aria-label="Dropdown menu" title="Dropdown menu">
  89. <span class="fa fa-ellipsis-v"/>
  90. </a>
  91. <div class="dropdown-menu" role="menu">
  92. <a role="menuitem" type="edit" class="dropdown-item">Modify template</a>
  93. <a t-if="widget.deletable" role="menuitem" type="delete" class="dropdown-item">Delete template</a>
  94. <div role="separator" class="dropdown-divider"/>
  95. <div role="separator" class="dropdown-item-text">Color</div>
  96. <ul class="oe_kanban_colorpicker" data-field="color"/>
  97. </div>
  98. </div>
  99. <div class="o_kanban_record_top">
  100. <h4 class="o_kanban_record_title mb4 d-block"><field name="title"/></h4>
  101. </div>
  102. <div class="o_kanban_record_bottom">
  103. <div class="oe_kanban_bottom_left">
  104. <div t-if="record.is_template.raw_value" class="badge-pill badge-warning">Template</div>
  105. </div>
  106. <div class="oe_kanban_bottom_right">
  107. <field name="activity_ids" widget="kanban_activity"/>
  108. </div>
  109. </div>
  110. </div>
  111. </templates>
  112. </kanban>
  113. </field>
  114. </record>
  115. <record id="survey_survey_template_act_window" model="ir.actions.act_window">
  116. <field name="name">Survey templates</field>
  117. <field name="res_model">survey.survey</field>
  118. <field name="view_type">form</field>
  119. <field name="view_mode">kanban,tree,form</field>
  120. <field name="domain">[('is_template','=',True)]</field>
  121. <field name="context">{'default_is_template':True}</field>
  122. <field name="help" type="html">
  123. <p class="o_view_nocontent_smiling_face">
  124. Create a new survey template from here
  125. </p>
  126. </field>
  127. </record>
  128. <record id="survey_survey_template_act_window_view_kanban" model="ir.actions.act_window.view">
  129. <field name="sequence" eval="1"/>
  130. <field name="view_mode">kanban</field>
  131. <field name="view_id" ref="survey_survey_template_kanban"/>
  132. <field name="act_window_id" ref="survey_survey_template_act_window"/>
  133. </record>
  134. <record id="survey_survey_template_act_window_view_tree" model="ir.actions.act_window.view">
  135. <field name="sequence" eval="2"/>
  136. <field name="view_mode">tree</field>
  137. <field name="view_id" ref="survey_survey_template_tree"/>
  138. <field name="act_window_id" ref="survey_survey_template_act_window"/>
  139. </record>
  140. <record id="survey_survey_to_template_server" model="ir.actions.server">
  141. <field name="name">Create template from survey</field>
  142. <field name="model_id" ref="survey.model_survey_survey"/>
  143. <field name="binding_model_id" ref="survey.model_survey_survey"/>
  144. <field name="binding_type">action_form_only</field>
  145. <field name="state">code</field>
  146. <field name="code">action = record.create_template_from_survey()</field>
  147. </record>
  148. <!-- survey config menus rearrange -->
  149. <record id="survey.menu_surveys_configuration" model="ir.ui.menu">
  150. <field name="groups_id" eval="[(6,0,[ref('survey.group_survey_manager')])]"/>
  151. </record>
  152. <menuitem
  153. id="survey_survey_template_menu"
  154. name="Survey templates"
  155. action="survey_survey_template_act_window"
  156. parent="survey.menu_surveys_configuration"
  157. sequence="0"
  158. groups="survey.group_survey_manager"/>
  159. <record id="survey.menu_survey_page_form1" model="ir.ui.menu">
  160. <field name="groups_id" eval="[(4, ref('base.group_no_one'))]"/>
  161. </record>
  162. <record id="survey.menu_survey_question_form1" model="ir.ui.menu">
  163. <field name="groups_id" eval="[(4, ref('base.group_no_one'))]"/>
  164. </record>
  165. <record id="survey.menu_survey_label_form1" model="ir.ui.menu">
  166. <field name="groups_id" eval="[(4, ref('base.group_no_one'))]"/>
  167. </record>
  168. <record id="survey.menu_survey_response_line_form" model="ir.ui.menu">
  169. <field name="groups_id" eval="[(4, ref('base.group_no_one'))]"/>
  170. </record>
  171. </odoo>