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.

160 lines
7.0 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Copyright (c) 2017-2019 MuK IT GmbH.
  4. This file is part of MuK Autovacuum
  5. (see https://mukit.at).
  6. This program is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU Lesser General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU Lesser General Public License for more details.
  14. You should have received a copy of the GNU Lesser General Public License
  15. along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. -->
  17. <odoo>
  18. <record id="view_autovacuum_rule_search" model="ir.ui.view">
  19. <field name="name">muk_autovacuum_rules.search</field>
  20. <field name="model">muk_autovacuum.rules</field>
  21. <field name="arch" type="xml">
  22. <search string="Auto Vacuum Rules">
  23. <field name="name" filter_domain="[('name', 'ilike', self)]" />
  24. <field name="model" />
  25. <field name="state" />
  26. <field name="active" />
  27. <filter string="All" name="all" domain="['|', ('active', '=', False), ('active', '=', True)]" />
  28. <group expand="0" name="group_by" string="Group By">
  29. <filter name="group_by_model" string="Model" domain="[]" context="{'group_by': 'model'}"/>
  30. </group>
  31. </search>
  32. </field>
  33. </record>
  34. <record id="view_autovacuum_rule_tree" model="ir.ui.view">
  35. <field name="name">muk_autovacuum_rules.tree</field>
  36. <field name="model">muk_autovacuum.rules</field>
  37. <field name="arch" type="xml">
  38. <tree string="Auto Vacuum Rules" decoration-muted="(not active)">
  39. <field name="sequence" widget="handle"/>
  40. <field name="name"/>
  41. <field name="model"/>
  42. <field name="state"/>
  43. <field name="active"/>
  44. </tree>
  45. </field>
  46. </record>
  47. <record id="view_autovacuum_rule_form" model="ir.ui.view">
  48. <field name="name">muk_autovacuum_rules.form</field>
  49. <field name="model">muk_autovacuum.rules</field>
  50. <field name="arch" type="xml">
  51. <form string="Auto Vacuum Rules">
  52. <sheet>
  53. <div class="oe_button_box" name="button_box">
  54. <button name="toggle_active" type="object" class="oe_stat_button" icon="fa-bell">
  55. <field name="active" widget="boolean_button"/>
  56. </button>
  57. </div>
  58. <div class="oe_title">
  59. <label for="name" class="oe_edit_only"/>
  60. <h1>
  61. <field name="name" placeholder="e.g. Delete Logs after 30 Days"/>
  62. </h1>
  63. </div>
  64. <group>
  65. <group>
  66. <field name="sequence"/>
  67. <field name="model"/>
  68. <field name="model_name" invisible="1"/>
  69. <field name="state"/>
  70. </group>
  71. <group>
  72. <field name="protect_starred"/>
  73. <field name="only_inactive"/>
  74. <field name="only_attachments"/>
  75. </group>
  76. </group>
  77. <notebook>
  78. <page string="Time Settings" name='time' autofocus="autofocus"
  79. attrs="{'invisible': [('state', '!=', 'time')]}">
  80. <group>
  81. <group>
  82. <field name="time_field"/>
  83. </group>
  84. <group>
  85. <field name="time_type"/>
  86. <field name="time"/>
  87. </group>
  88. </group>
  89. </page>
  90. <page string="Size Settings" name='size' autofocus="autofocus"
  91. attrs="{'invisible': [('state', '!=', 'size')]}">
  92. <group>
  93. <group>
  94. <field name="size_type"/>
  95. </group>
  96. <group>
  97. <field name="size_parameter"
  98. attrs="{'invisible': [('size_type', '!=', 'parameter')]}"/>
  99. <field name="size_parameter_value"
  100. attrs="{'invisible': [('size_type', '!=', 'parameter')]}"/>
  101. <field name="size"
  102. attrs="{'invisible': [('size_type', '!=', 'fixed')]}"/>
  103. <field name="size_order"/>
  104. </group>
  105. </group>
  106. </page>
  107. <page string="Domain Settings" name='domain' autofocus="autofocus"
  108. attrs="{'invisible': [('state', '!=', 'domain')]}">
  109. <field name="domain" widget="domain" options="{'model': 'model_name'}" />
  110. </page>
  111. <page string="Code Settings" name='code' autofocus="autofocus"
  112. attrs="{'invisible': [('state', '!=', 'code')]}">
  113. <field name="code" widget="ace" options="{'mode': 'python'}"
  114. placeholder="Enter Python code here. Help about Python expression is available in the help tab of this document."/>
  115. </page>
  116. <page string="Help" attrs="{'invisible': [('state', '!=', 'code')]}">
  117. <group>
  118. <div style="margin-top: 4px;">
  119. <h3>Help with Python expressions</h3>
  120. <p>Various fields may use Python code or Python expressions. The following variables can be used:</p>
  121. <ul>
  122. <li><code>uid</code>, <code>user</code>: User on which the rule is triggered</li>
  123. <li><code>env</code>: Odoo Environment on which the rule is triggered</li>
  124. <li><code>model</code>: Odoo Model of the record on which the rule is triggered</li>
  125. <li><code>b64encode</code>, <code>b64decode</code>: Base64 converter</li>
  126. <li><code>time</code>, <code>datetime</code>, <code>dateutil</code>, <code>timezone</code>: useful Python libraries</li>
  127. <li><code>date_format</code>, <code>datetime_format</code>: server date and time formats</li>
  128. <li><code>logger.info(message)</code>: Python logging framework</li>
  129. <li><code>Warning</code>: Warning Exception to use with <code>raise</code></li>
  130. </ul>
  131. </div>
  132. </group>
  133. </page>
  134. </notebook>
  135. </sheet>
  136. </form>
  137. </field>
  138. </record>
  139. <record id="action_autovacuum_rule" model="ir.actions.act_window">
  140. <field name="name">Auto Vacuum Rules</field>
  141. <field name="res_model">muk_autovacuum.rules</field>
  142. <field name="view_mode">tree,form</field>
  143. <field name="context">{'search_default_all': 1}</field>
  144. </record>
  145. <menuitem id="menu_autovacuum_rules" name="Auto Vacuum Rules"
  146. parent="base.menu_automation" action="action_autovacuum_rule"/>
  147. </odoo>