stock_view.xml 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
  4. License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  5. -->
  6. <openerp>
  7. <data>
  8. <!-- LOTS -->
  9. <record id="view_production_lot_form" model="ir.ui.view">
  10. <field name="name">product_expiry_simple.stock.production.lot.form</field>
  11. <field name="model">stock.production.lot</field>
  12. <field name="inherit_id" ref="stock.view_production_lot_form"/>
  13. <field name="arch" type="xml">
  14. <field name="ref" position="after">
  15. <field name="expiry_date"/>
  16. </field>
  17. </field>
  18. </record>
  19. <record id="view_production_lot_tree" model="ir.ui.view">
  20. <field name="name">product_expiry_simple.stock.production.lot.tree</field>
  21. <field name="model">stock.production.lot</field>
  22. <field name="inherit_id" ref="stock.view_production_lot_tree"/>
  23. <field name="arch" type="xml">
  24. <field name="product_id" position="after">
  25. <field name="expiry_date"/>
  26. </field>
  27. <xpath expr="/tree" position="attributes">
  28. <attribute name="colors">red:expiry_date and expiry_date &lt; current_date;green:expiry_date &gt;= current_date</attribute>
  29. </xpath>
  30. </field>
  31. </record>
  32. <record id="search_product_lot_filter" model="ir.ui.view">
  33. <field name="name">product_expiry_simple.stock.production.lot.search</field>
  34. <field name="model">stock.production.lot</field>
  35. <field name="inherit_id" ref="stock.search_product_lot_filter"/>
  36. <field name="arch" type="xml">
  37. <field name="product_id" position="after">
  38. <filter string="Vencidos" name="expired"
  39. domain="[('expiry_date', '&lt;', context_today().strftime('%Y-%m-%d'))]"/>
  40. <filter string="No vencidos" name="no-expired"
  41. domain="[('expiry_date', '&gt;=', context_today().strftime('%Y-%m-%d'))]"/>
  42. </field>
  43. <group expand="0" position="inside">
  44. <filter name="expiry_date_month" string="Mes de vencimiento"
  45. context="{'group_by': 'expiry_date:month'}"/>
  46. <filter name="expiry_date_day" string="Día de vencimiento"
  47. context="{'group_by': 'expiry_date:day'}"/>
  48. </group>
  49. </field>
  50. </record>
  51. <!-- QUANTS -->
  52. <!-- No need to inherit the form view, because the expiry date is shown in the lot_id via display_name field -->
  53. <record id="view_stock_quant_tree" model="ir.ui.view">
  54. <field name="name">product_expiry_simple.stock.quant.tree</field>
  55. <field name="model">stock.quant</field>
  56. <field name="inherit_id" ref="stock.view_stock_quant_tree"/>
  57. <field name="arch" type="xml">
  58. <field name="lot_id" position="after">
  59. <field name="expiry_date"/>
  60. </field>
  61. <xpath expr="/tree" position="attributes">
  62. <attribute name="colors">red:expiry_date and expiry_date &lt; current_date;green:expiry_date &gt;= current_date</attribute>
  63. </xpath>
  64. </field>
  65. </record>
  66. <record id="quant_search_view" model="ir.ui.view">
  67. <field name="name">product_expiry_simple.stock.quant.search</field>
  68. <field name="model">stock.quant</field>
  69. <field name="inherit_id" ref="stock.quant_search_view"/>
  70. <field name="arch" type="xml">
  71. <filter name="internal_loc" position="after">
  72. <separator/>
  73. <filter string="Vencidos" name="expired"
  74. domain="[('expiry_date', '&lt;', context_today().strftime('%Y-%m-%d'))]"
  75. groups="stock.group_production_lot"/>
  76. <filter string="No vencidos" name="no-expired"
  77. domain="[('expiry_date', '&gt;=', context_today().strftime('%Y-%m-%d'))]"
  78. groups="stock.group_production_lot"/>
  79. </filter>
  80. <filter context="{'group_by' : 'lot_id'}" position="after">
  81. <filter name="expiry_date_month" string="Mes de vencimiento"
  82. context="{'group_by': 'expiry_date:month'}" groups="stock.group_production_lot"/>
  83. <filter name="expiry_date_day" string="Día de vencimiento"
  84. context="{'group_by': 'expiry_date:day'}" groups="stock.group_production_lot"/>
  85. </filter>
  86. </field>
  87. </record>
  88. </data>
  89. </openerp>