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.

85 lines
4.0 KiB

  1. <?xml version="1.0" ?>
  2. <odoo>
  3. <record id="view_exception_rule_tree" model="ir.ui.view">
  4. <field name="name">exception.rule.tree</field>
  5. <field name="model">exception.rule</field>
  6. <field name="arch" type="xml">
  7. <tree string="Exception Rule">
  8. <field name="sequence" widget="handle"/>
  9. <field name="name"/>
  10. <field name="description"/>
  11. <field name="model"/>
  12. <field name="active" widget="boolean_toggle"/>
  13. </tree>
  14. </field>
  15. </record>
  16. <record id="view_exception_rule_form" model="ir.ui.view">
  17. <field name="name">exception.rule.form</field>
  18. <field name="model">exception.rule</field>
  19. <field name="arch" type="xml">
  20. <form string="Exception Rule Setup" name="exception_rule">
  21. <sheet>
  22. <div class="oe_button_box" name="button_box">
  23. <button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive">
  24. <field name="active" widget="boolean_button"/>
  25. </button>
  26. </div>
  27. <div class="oe_title">
  28. <label for="name" class="oe_edit_only"/>
  29. <h1><field name="name"/></h1>
  30. </div>
  31. <group>
  32. <group>
  33. <field name="description"/>
  34. </group>
  35. </group>
  36. <group>
  37. <group colspan="4" groups="base.group_system">
  38. <field name="model"/>
  39. <field name="exception_type" widget="radio"/>
  40. <field name="domain" attrs="{'invisible': [('exception_type','!=','by_domain')], 'required': [('exception_type','=','by_domain')]}"/>
  41. </group>
  42. </group>
  43. <notebook>
  44. <page name="code" string="Python Code" attrs="{'invisible': [('exception_type','!=','by_py_code')], 'required': [('exception_type','=','by_py_code')]}">
  45. <field name="code" widget="ace" options="{'mode': 'python'}" placeholder="Enter Python code here. Help about Python expression is available in the help tab of this document."/>
  46. </page>
  47. <page name="help" string="Help" attrs="{'invisible': [('exception_type','!=','by_py_code')]}">
  48. <group>
  49. <div style="margin-top: 4px;">
  50. <h3>Help with Python expressions</h3>
  51. <p>Various fields may use Python code or Python expressions. The following variables can be used:</p>
  52. <ul>
  53. <li><code>self</code>: Record on which the rule is evaluated.</li>
  54. <li><code>time</code>: useful Python libraries</li>
  55. <li>To block the exception use: <code>failed = True</code></li>
  56. </ul>
  57. </div>
  58. </group>
  59. </page>
  60. </notebook>
  61. </sheet>
  62. </form>
  63. </field>
  64. </record>
  65. <record id="action_exception_rule_tree" model="ir.actions.act_window">
  66. <field name="name">Exception Rules</field>
  67. <field name="res_model">exception.rule</field>
  68. <field name="view_type">form</field>
  69. <field name="view_mode">tree,form</field>
  70. <field name="view_id" ref="view_exception_rule_tree"/>
  71. <field name="context">{'active_test': False}</field>
  72. </record>
  73. <menuitem
  74. action="action_exception_rule_tree"
  75. id="menu_action_exception"
  76. parent="base.menu_custom"
  77. sequence="90"
  78. groups="base_exception.group_exception_rule_manager"
  79. />
  80. </odoo>