website_pages_views.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <?xml version="1.0"?>
  2. <odoo>
  3. <record id="website_pages_form_view" model="ir.ui.view">
  4. <field name="name">website.page.form</field>
  5. <field name="model">website.page</field>
  6. <field name="arch" type="xml">
  7. <form string="Website Page Settings">
  8. <sheet>
  9. <group>
  10. <group>
  11. <field name="name"/>
  12. <field name="url"/>
  13. <field name="view_id" context="{'display_website': True}" options="{'always_reload': True}"/>
  14. <field name="website_id" options="{'no_create': True}" groups="website.group_multi_website"/>
  15. <field name="track"/>
  16. </group>
  17. <group>
  18. <field name="website_indexed"/>
  19. <field name="is_published"/>
  20. <field name="date_publish"/>
  21. </group>
  22. </group>
  23. <label for="menu_ids" string="Related Menu Items"/>
  24. <field name="menu_ids"/>
  25. </sheet>
  26. </form>
  27. </field>
  28. </record>
  29. <record id="website_page_properties_view_form" model="ir.ui.view">
  30. <field name="name">website.page.properties.form.view</field>
  31. <field name="model">website.page</field>
  32. <field name="arch" type="xml">
  33. <form>
  34. <notebook>
  35. <page string="Name">
  36. <group class="mt-4">
  37. <field name="name" string="Page Name" placeholder="e.g. Home Page"/>
  38. <field name="website_id" invisible="1"/>
  39. <field name="url" string="Page URL" widget="page_url"/>
  40. </group>
  41. </page>
  42. <page string="Publish">
  43. <group class="mt-4">
  44. <field name="is_in_menu" string="Show in Top Menu" widget="boolean_toggle"/>
  45. <field name="is_homepage" string="Use as Homepage" widget="boolean_toggle"/>
  46. <field name="website_indexed" string="Indexed" widget="boolean_toggle" help="Hide this page from search results"/>
  47. <field name="is_published" string="Published" widget="boolean_toggle"/>
  48. <field name="date_publish" widget="datetime"/>
  49. <field name="visibility"/>
  50. <field name="visibility_password_display" attrs="{'invisible': [('visibility', '!=', 'password')], 'required': [('visibility', '=', 'password')]}" password="True" string="Password"/>
  51. <field name="groups_id" attrs="{'invisible': [('visibility', '!=', 'restricted_group')]}" string="Authorized Groups" widget="many2many_tags"/>
  52. </group>
  53. </page>
  54. </notebook>
  55. </form>
  56. </field>
  57. </record>
  58. <record id="website_pages_tree_view" model="ir.ui.view">
  59. <field name="name">website.page.list</field>
  60. <field name="model">website.page</field>
  61. <field name="priority">99</field>
  62. <field name="arch" type="xml">
  63. <tree js_class="website_pages_list" type="object" action="open_website_url" multi_edit="1" default_order="url asc, id asc">
  64. <field name="is_homepage" invisible="1"/>
  65. <field name="name" string="Page Title"/>
  66. <field name="website_url" string="Page URL"/>
  67. <field name="view_id" invisible="1"/>
  68. <field name="website_indexed"/>
  69. <field name="is_in_menu" string="Is In Main Menu"/>
  70. <field name="is_seo_optimized"/>
  71. <field name="is_published"/>
  72. <field name="create_uid" invisible="1"/>
  73. <field name="write_uid" widget="many2one_avatar" optional="hide"/>
  74. <field name="write_date" optional="hide"/>
  75. <field name="track" optional="hide"/>
  76. <!-- website_id should be shown only in multi website environment
  77. when the group is enabled, but we need the field to be there all the
  78. time for `PageRendererMixin`'s `recordFilter' to be able to filter
  79. correctly. -->
  80. <field name="website_id" invisible="1"/>
  81. <field name="website_id" groups="website.group_multi_website"/>
  82. <button name="action_page_debug_view" type="object" title="Settings" icon="fa-bug fa-lg" groups="base.group_no_one"/>
  83. </tree>
  84. </field>
  85. </record>
  86. <record id="website_pages_kanban_view" model="ir.ui.view">
  87. <field name="name">website.page.kanban</field>
  88. <field name="model">website.page</field>
  89. <field name="priority">99</field>
  90. <field name="arch" type="xml">
  91. <kanban js_class="website_pages_kanban" action="open_website_url" type="object" sample="1">
  92. <field name="name"/>
  93. <field name="is_homepage"/>
  94. <field name="website_url"/>
  95. <field name="website_id" invisible="1"/>
  96. <templates>
  97. <t t-name="kanban-box">
  98. <div class="d-flex flex-column">
  99. <div class="o_text_overflow fw-bold mb-auto">
  100. <span class="fs-3">
  101. <i t-if="record.is_homepage.raw_value" class="fa fa-home pe-2"
  102. title="Home page of the current website"/>
  103. <t t-esc="record.name.value"/>
  104. </span>
  105. <div class="text-muted">
  106. <t t-if="record.website_id.value">
  107. <i class="fa fa-globe me-1" title="Website"/>
  108. <field name="website_id" groups="website.group_multi_website"/>
  109. </t>
  110. </div>
  111. <span class="text-primary" t-esc="record.website_url.value"/>
  112. </div>
  113. <div><field name="is_in_menu" widget="boolean"/> In Main Menu</div>
  114. <div><field name="is_seo_optimized" widget="boolean"/> SEO Optimized</div>
  115. <div class="border-top mt-2 pt-2">
  116. <field name="is_published" widget="boolean_toggle"/>
  117. <t t-if="record.is_published.raw_value">Published</t>
  118. <t t-else="">Not Published</t>
  119. <button
  120. class="btn-link float-end p-0"
  121. name="action_page_debug_view"
  122. groups="base.group_no_one"
  123. title="Settings"
  124. type="object"
  125. icon="fa-bug"
  126. />
  127. </div>
  128. </div>
  129. </t>
  130. </templates>
  131. </kanban>
  132. </field>
  133. </record>
  134. <record id="website_pages_view_search" model="ir.ui.view">
  135. <field name="name">website.page.view.search</field>
  136. <field name="model">website.page</field>
  137. <field name="arch" type="xml">
  138. <search string="Website Pages" >
  139. <field name="url"/>
  140. <filter string="Published" name="published" domain="[('website_published', '=', True)]"/>
  141. <filter string="Not published" name="not_published" domain="[('website_published', '=', False)]"/>
  142. <separator/>
  143. <filter string="Tracked" name="tracked" domain="[('track', '=', True)]"/>
  144. <filter string="Not tracked" name="not_tracked" domain="[('track', '=', False)]"/>
  145. </search>
  146. </field>
  147. </record>
  148. <record id="action_website_pages_list" model="ir.actions.act_window">
  149. <field name="name">Website Pages</field>
  150. <field name="res_model">website.page</field>
  151. <field name="view_mode">tree,kanban</field>
  152. <field name="view_ids" eval="[(5, 0, 0),
  153. (0, 0, {'view_mode': 'tree', 'view_id': ref('website_pages_tree_view')}),
  154. (0, 0, {'view_mode': 'kanban', 'view_id': ref('website_pages_kanban_view')}),
  155. ]"/>
  156. </record>
  157. <menuitem id="menu_website_pages_list"
  158. parent="menu_content"
  159. sequence="10"
  160. name="Pages"
  161. action="action_website_pages_list"/>
  162. <!-- Extension of views for ir.ui.view and link with the page manager -->
  163. <record id="view_view_form_extend" model="ir.ui.view">
  164. <field name="model">ir.ui.view</field>
  165. <field name="inherit_id" ref="base.view_view_form"/>
  166. <field name="arch" type="xml">
  167. <field name="inherit_id" position="attributes">
  168. <attribute name="context">{'display_website': True}</attribute>
  169. <attribute name="options">{'always_reload': True}</attribute>
  170. </field>
  171. <field name="model" position="before">
  172. <field name="website_id" options="{'no_create': True}" groups="website.group_multi_website"/>
  173. <label for="key"/>
  174. <div class='o_row'>
  175. <field name="key"/>
  176. <button title="Show site map" attrs="{'invisible': [('type', '!=', 'qweb')]}" name="website.action_show_viewhierarchy" icon="fa-sitemap" type="action" class="btn btn-link"/>
  177. </div>
  178. <field name="page_ids" invisible="1" />
  179. <field name="first_page_id" attrs="{'invisible': [('page_ids', '=', [])]}" />
  180. <field name="visibility" attrs="{'invisible': [('type', '!=', 'qweb')]}" />
  181. <field name="visibility_password_display" attrs="{'invisible': [('visibility', '!=', 'password')]}" password="True" string="Visibility Password" />
  182. </field>
  183. <sheet position="before">
  184. <header>
  185. <button type="action" name="website.action_website_pages_list"
  186. string="Go to Page Manager" attrs="{'invisible': [('page_ids', '=', [])]}"/>
  187. </header>
  188. </sheet>
  189. <field name="active" position="after">
  190. <field name="track" attrs="{'invisible': [('type', '!=', 'qweb')]}" widget="boolean_toggle"/>
  191. </field>
  192. </field>
  193. </record>
  194. <record id="view_view_tree_inherit_website" model="ir.ui.view">
  195. <field name="model">ir.ui.view</field>
  196. <field name="inherit_id" ref="base.view_view_tree"/>
  197. <field name="arch" type="xml">
  198. <tree position="attributes">
  199. <attribute name="decoration-muted">not active</attribute>
  200. </tree>
  201. <field name="name" position="after">
  202. <field name="active" invisible="1"/>
  203. <field name="website_id" groups="website.group_multi_website"/>
  204. </field>
  205. <field name="xml_id" position="before">
  206. <field name="key" groups="website.group_multi_website"/>
  207. </field>
  208. </field>
  209. </record>
  210. </odoo>