purchase_analytics.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <openerp>
  3. <data>
  4. <record model="ir.ui.view" id="farm_purchase_order_form_inherit">
  5. <field name="name">farm.purchase.order.form.inherit</field>
  6. <field name="model">purchase.order</field>
  7. <field name="inherit_id" ref="purchase.purchase_order_form"/>
  8. <field name="arch" type="xml">
  9. <button name="action_cancel" position="after">
  10. <field name="imputed" attrs="{'invisible': True}"/>
  11. <button name="set_purchase_analitics" states="draft,confirmed" string="Set Analitics"
  12. type="object" attrs="{'invisible': [('imputed', '=', True)]}"/>
  13. </button>
  14. <xpath expr="//field[@name='order_line']/tree" position="inside">
  15. <field name="farm"/>
  16. <field name="location_id"/>
  17. <field name="start_date" attrs="{'required': ['|',('farm', '!=', False),('general_expense', '=', True)]}"/>
  18. <field name="end_date" attrs="{'required': ['|',('farm', '!=', False),('general_expense', '=', True)]}"/>
  19. <field name="general_expense"/>
  20. </xpath>
  21. </field>
  22. </record>
  23. <record model="ir.ui.view" id="view_farm_purchase_line_tree">
  24. <field name="name">farm.purchase.line.tree</field>
  25. <field name="model">purchase.order.line</field>
  26. <field name="type">tree</field>
  27. <field name="arch" type="xml">
  28. <tree string="Purchase lines">
  29. <field name="product_id"/>
  30. <field name="farm"/>
  31. <field name="location_id"/>
  32. <field name="start_date"/>
  33. <field name="end_date"/>
  34. <field name="aux_price_subtotal" sum="Tot. price"/>
  35. <field name="imputed"/>
  36. </tree>
  37. </field>
  38. </record>
  39. <record model="ir.ui.view" id="view_farm_purchase_line_form">
  40. <field name="name">farm.purchase.line.form</field>
  41. <field name="model">purchase.order.line</field>
  42. <field name="type">form</field>
  43. <field name="arch" type="xml">
  44. <form string="Purchase line">
  45. <sheet>
  46. <group col="4" colspan="2">
  47. <field name="order_id" attrs="{'readonly':True}"/>
  48. <field name="farm"/>
  49. <field name="location_id"/>
  50. <field name="start_date"/>
  51. <field name="end_date"/>
  52. <field name="price_subtotal" attrs="{'readonly':True}"/>
  53. <field name="imputed" attrs="{'readonly':True}"/>
  54. </group>
  55. </sheet>
  56. </form>
  57. </field>
  58. </record>
  59. <record model="ir.ui.view" id="farm_purchase_line_search_view">
  60. <field name="name">farm.purchase.line.search</field>
  61. <field name="model">purchase.order.line</field>
  62. <field name="arch" type="xml">
  63. <search string="Search Animal group">
  64. <group>
  65. <field name="farm"/>
  66. <field name="location_id"/>
  67. <field name="product_id"/>
  68. <field name="start_date"/>
  69. </group>
  70. <newline />
  71. <group expand="0" string="Group by...">
  72. <filter string="Farm"
  73. domain="[]"
  74. context="{'group_by': 'farm'}" />
  75. <filter string="Product"
  76. domain="[]"
  77. context="{'group_by': 'product_id'}" />
  78. <filter string="Location"
  79. domain="[]"
  80. context="{'group_by': 'location'}" />
  81. <filter string="month"
  82. domain="[]"
  83. context="{'group_by': 'start_date:month'}" />
  84. </group>
  85. </search>
  86. </field>
  87. </record>
  88. <record id="impute_analitics_action" model="ir.actions.server">
  89. <field name="name">Impute analitics</field>
  90. <field name="type">ir.actions.server</field>
  91. <field name="model_id" ref="model_purchase_order_line"/>
  92. <field name="state">code</field>
  93. <field name="code">self.browse(cr,uid,context.get('active_ids', [])).impute_purchase_order()</field>
  94. </record>
  95. <record id="impute analitics" model="ir.values">
  96. <field name="name">impute_analitics</field>
  97. <field name="key">action</field>
  98. <field name="key2">client_action_multi</field>
  99. <field name="model">purchase.order.line</field>
  100. <field name="value" eval="'ir.actions.server,%d'%impute_analitics_action"/>
  101. </record>
  102. </data>
  103. </openerp>