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.

143 lines
6.5 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_editable" model="ir.ui.view">
  27. <field name="model">custom.info.value</field>
  28. <field name="arch" type="xml">
  29. <custom_info string="Custom Property Values">
  30. <field name="name"/>
  31. <field name="owner_id"/>
  32. <field name="property_id" force_save="1" readonly="0"/>
  33. <field name="category_id"/>
  34. <field name="required"/>
  35. <field name="widget"/>
  36. <field name="field_type"/>
  37. <field name="value_str"/>
  38. <field name="value_bool"/>
  39. <field name="value_int"/>
  40. <field name="value_float"/>
  41. <field name="value_date"/>
  42. <field name="value"/>
  43. <field name="value_id"/>
  44. </custom_info>
  45. </field>
  46. </record>
  47. <record id="custom_info_value_tree_editable" model="ir.ui.view">
  48. <field name="model">custom.info.value</field>
  49. <field name="priority" eval="999"/>
  50. <field name="mode">primary</field>
  51. <field name="inherit_id" ref="custom_info_value_tree"/>
  52. <field name="arch" type="xml">
  53. <tree position="attributes">
  54. <attribute name="editable">bottom</attribute>
  55. </tree>
  56. <field name="owner_id" position="replace" />
  57. </field>
  58. </record>
  59. <record id="custom_info_value_form" model="ir.ui.view">
  60. <field name="model">custom.info.value</field>
  61. <field name="arch" type="xml">
  62. <form>
  63. <sheet>
  64. <group name="metadata">
  65. <field name="owner_id" invisible="context.get('embed')"/>
  66. <field name="property_id" readonly="context.get('embed')"/>
  67. <field name="category_id"/>
  68. <field name="field_type" readonly="True"/>
  69. <field name="required" readonly="True"/>
  70. </group>
  71. <group name="value">
  72. <field name="value_str"
  73. attrs="{'invisible': [('field_type', '!=', 'str')], 'required': [('required', '=', True), ('field_type', '=', 'str')]}"
  74. />
  75. <field name="value_int"
  76. attrs="{'invisible': [('field_type', '!=', 'int')], 'required': [('required', '=', True), ('field_type', '=', 'int')]}"
  77. />
  78. <field name="value_float"
  79. attrs="{'invisible': [('field_type', '!=', 'float')], 'required': [('required', '=', True), ('field_type', '=', 'float')]}"
  80. />
  81. <field name="value_bool"
  82. attrs="{'invisible': [('field_type', '!=', 'bool')], 'required': [('required', '=', True), ('field_type', '=', 'bool')]}"
  83. />
  84. <field name="value_date"
  85. attrs="{'invisible': [('field_type', '!=', 'date')], 'required': [('required', '=', True), ('field_type', '=', 'date')]}"
  86. />
  87. <field name="value_id"
  88. widget="selection"
  89. attrs="{'invisible': [('field_type', '!=', 'id')], 'required': [('required', '=', True), ('field_type', '=', 'id')]}"
  90. />
  91. </group>
  92. <div class="alert alert-warning" role="alert" invisible="not context.get('embed')">
  93. <strong>Warning!</strong>
  94. You might see no changes in parent form until you save it.
  95. </div>
  96. </sheet>
  97. </form>
  98. </field>
  99. </record>
  100. <record id="custom_info_value_search" model="ir.ui.view">
  101. <field name="model">custom.info.value</field>
  102. <field name="arch" type="xml">
  103. <search>
  104. <field name="model"/>
  105. <field name="res_id"/>
  106. <field name="category_id"/>
  107. <field name="property_id"/>
  108. <group expand="0" string="Group By">
  109. <filter
  110. string="Model"
  111. name="model"
  112. context="{'group_by': 'model'}"/>
  113. <filter
  114. string="Resource"
  115. name="resource"
  116. context="{'group_by': 'res_id'}"/>
  117. <filter
  118. string="Category"
  119. name="category"
  120. context="{'group_by': 'category_id'}"/>
  121. <filter
  122. string="Property"
  123. name="property"
  124. context="{'group_by': 'property_id'}"/>
  125. </group>
  126. </search>
  127. </field>
  128. </record>
  129. <record id="custom_info_value_action" model="ir.actions.act_window">
  130. <field name="name">Values</field>
  131. <field name="type">ir.actions.act_window</field>
  132. <field name="res_model">custom.info.value</field>
  133. <field name="view_mode">tree,form</field>
  134. <field name="view_type">form</field>
  135. </record>
  136. </odoo>