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.

112 lines
5.0 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" invisible="context.get('embed')"/>
  11. <field name="property_id"/>
  12. <field name="category_id"/>
  13. <field name="required" invisible="1"/>
  14. <field name="value"
  15. attrs="{'required': [('required', '=', True)]}"
  16. />
  17. </tree>
  18. </field>
  19. </record>
  20. <record id="custom_info_value_tree_editable" model="ir.ui.view">
  21. <field name="model">custom.info.value</field>
  22. <field name="priority" eval="999"/>
  23. <field name="mode">primary</field>
  24. <field name="inherit_id" ref="custom_info_value_tree"/>
  25. <field name="arch" type="xml">
  26. <tree position="attributes">
  27. <attribute name="editable">bottom</attribute>
  28. </tree>
  29. <field name="value" position="after">
  30. <field name="field_type" invisible="1"/>
  31. <field name="value_id"
  32. widget="selection"
  33. attrs="{'invisible': [('field_type', '!=', 'id')], 'required': [('required', '=', True), ('field_type', '=', 'id')]}"
  34. />
  35. </field>
  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" 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. <field name="value"/>
  85. <group expand="0" string="Group By">
  86. <filter
  87. string="Owner"
  88. context="{'group_by': ['model' , 'res_id']}"/>
  89. <filter
  90. string="Category"
  91. context="{'group_by': 'category_id'}"/>
  92. <filter
  93. string="Property"
  94. context="{'group_by': 'property_id'}"/>
  95. </group>
  96. </search>
  97. </field>
  98. </record>
  99. <record id="custom_info_value_action" model="ir.actions.act_window">
  100. <field name="name">Values</field>
  101. <field name="type">ir.actions.act_window</field>
  102. <field name="res_model">custom.info.value</field>
  103. <field name="view_mode">tree,form</field>
  104. <field name="view_type">form</field>
  105. </record>
  106. </odoo>