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.

190 lines
7.8 KiB

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