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.

118 lines
5.4 KiB

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
  3. Copyright 2017 Pedro M. Baeza <pedro.baeza@tecnativa.com>
  4. License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
  5. <odoo>
  6. <record id="custom_info_value_tree" model="ir.ui.view">
  7. <field name="model">custom.info.value</field>
  8. <field name="arch" type="xml">
  9. <tree string="Custom Property Values" create="0" delete="0">
  10. <field name="owner_id" />
  11. <field name="property_id" force_save="1"/>
  12. <field name="category_id" force_save="1"/>
  13. <field name="required" invisible="1"/>
  14. <field name="field_type" invisible="1"/>
  15. <field name="value"
  16. attrs="{'invisible': [('field_type', '=', 'id')], 'required': [('required', '=', True), ('field_type', '!=', 'id')]}"
  17. />
  18. <field name="value_id"
  19. force_save="1"
  20. options="{'no_create': True, 'no_open': True}"
  21. attrs="{'invisible': [('field_type', '!=', 'id')], 'required': [('required', '=', True), ('field_type', '=', 'id')]}"
  22. />
  23. </tree>
  24. </field>
  25. </record>
  26. <record id="custom_info_value_tree_editable" model="ir.ui.view">
  27. <field name="model">custom.info.value</field>
  28. <field name="priority" eval="999"/>
  29. <field name="mode">primary</field>
  30. <field name="inherit_id" ref="custom_info_value_tree"/>
  31. <field name="arch" type="xml">
  32. <tree position="attributes">
  33. <attribute name="editable">bottom</attribute>
  34. </tree>
  35. <field name="owner_id" position="replace" />
  36. </field>
  37. </record>
  38. <record id="custom_info_value_form" model="ir.ui.view">
  39. <field name="model">custom.info.value</field>
  40. <field name="arch" type="xml">
  41. <form>
  42. <sheet>
  43. <group name="metadata">
  44. <field name="owner_id" invisible="context.get('embed')"/>
  45. <field name="property_id" readonly="context.get('embed')"/>
  46. <field name="category_id"/>
  47. <field name="field_type" readonly="True"/>
  48. <field name="required" readonly="True"/>
  49. </group>
  50. <group name="value">
  51. <field name="value_str"
  52. attrs="{'invisible': [('field_type', '!=', 'str')], 'required': [('required', '=', True), ('field_type', '=', 'str')]}"
  53. />
  54. <field name="value_int"
  55. attrs="{'invisible': [('field_type', '!=', 'int')], 'required': [('required', '=', True), ('field_type', '=', 'int')]}"
  56. />
  57. <field name="value_float"
  58. attrs="{'invisible': [('field_type', '!=', 'float')], 'required': [('required', '=', True), ('field_type', '=', 'float')]}"
  59. />
  60. <field name="value_bool"
  61. attrs="{'invisible': [('field_type', '!=', 'bool')], 'required': [('required', '=', True), ('field_type', '=', 'bool')]}"
  62. />
  63. <field name="value_id"
  64. widget="selection"
  65. attrs="{'invisible': [('field_type', '!=', 'id')], 'required': [('required', '=', True), ('field_type', '=', 'id')]}"
  66. />
  67. </group>
  68. <div class="alert alert-warning" role="alert" invisible="not context.get('embed')">
  69. <strong>Warning!</strong>
  70. You might see no changes in parent form until you save it.
  71. </div>
  72. </sheet>
  73. </form>
  74. </field>
  75. </record>
  76. <record id="custom_info_value_search" model="ir.ui.view">
  77. <field name="model">custom.info.value</field>
  78. <field name="arch" type="xml">
  79. <search>
  80. <field name="model"/>
  81. <field name="res_id"/>
  82. <field name="category_id"/>
  83. <field name="property_id"/>
  84. <group expand="0" string="Group By">
  85. <filter
  86. string="Model"
  87. name="model"
  88. context="{'group_by': 'model'}"/>
  89. <filter
  90. string="Resource"
  91. name="resource"
  92. context="{'group_by': 'res_id'}"/>
  93. <filter
  94. string="Category"
  95. name="category"
  96. context="{'group_by': 'category_id'}"/>
  97. <filter
  98. string="Property"
  99. name="property"
  100. context="{'group_by': 'property_id'}"/>
  101. </group>
  102. </search>
  103. </field>
  104. </record>
  105. <record id="custom_info_value_action" model="ir.actions.act_window">
  106. <field name="name">Values</field>
  107. <field name="type">ir.actions.act_window</field>
  108. <field name="res_model">custom.info.value</field>
  109. <field name="view_mode">tree,form</field>
  110. <field name="view_type">form</field>
  111. </record>
  112. </odoo>