| 1 |
<?xml version="1.0" encoding='UTF-8'?> |
| 2 |
<odoo> |
| 3 |
<record id="view_move_form_expiry" model="ir.ui.view"> |
| 4 |
<field name="name">stock.production.lot.inherit.form</field> |
| 5 |
<field name="model">stock.lot</field> |
| 6 |
<field name="inherit_id" ref="stock.view_production_lot_form" /> |
| 7 |
<field name="arch" type="xml"> |
| 8 |
<xpath expr="//group[@name='description']" position="before"> |
| 9 |
<group string="Dates" name="expiration_dates" invisible="not use_expiration_date"> |
| 10 |
<field name="use_expiration_date" invisible="1"/> |
| 11 |
<group> |
| 12 |
<field string="Expiration" name="expiration_date"/> |
| 13 |
<field string="Alert from" name="alert_date"/> |
| 14 |
<field string="Best before" name="use_date"/> |
| 15 |
<field string="Removal Date" name="removal_date"/> |
| 16 |
</group> |
| 17 |
</group> |
| 18 |
</xpath> |
| 19 |
<xpath expr="//div[hasclass('oe_title')]" position="before"> |
| 20 |
<field name="product_expiry_alert" invisible="1"/> |
| 21 |
<span class="badge rounded-pill float-end text-bg-warning" |
| 22 |
invisible="not (alert_date <= time.strftime('%Y-%m-%d %H:%M:%S') < expiration_date)">Expiring</span> |
| 23 |
<span class="badge rounded-pill float-end text-bg-danger" |
| 24 |
invisible="not product_expiry_alert">Expired</span> |
| 25 |
</xpath> |
| 26 |
<xpath expr="//field[@name='ref']" position="after"> |
| 27 |
<field name="expiration_date" invisible="not use_expiration_date or display_complete"/> |
| 28 |
</xpath> |
| 29 |
</field> |
| 30 |
</record> |
| 31 |
|
| 32 |
<record id="search_product_lot_filter_inherit_product_expiry" model="ir.ui.view"> |
| 33 |
<field name="name">stock.production.lot.search.inherit</field> |
| 34 |
<field name="model">stock.lot</field> |
| 35 |
<field name="inherit_id" ref="stock.search_product_lot_filter"/> |
| 36 |
<field name="arch" type="xml"> |
| 37 |
<xpath expr="//field[@name='product_id']" position="after"> |
| 38 |
<filter string="Expiration Alerts" name="expiration_alerts" domain="[('alert_date', '<=', 'now')]"/> |
| 39 |
</xpath> |
| 40 |
</field> |
| 41 |
</record> |
| 42 |
|
| 43 |
<record id="view_production_lot_view_tree" model="ir.ui.view"> |
| 44 |
<field name="name">stock.production.lot.list.inherit.product.expiry</field> |
| 45 |
<field name="model">stock.lot</field> |
| 46 |
<field name="inherit_id" ref="stock.view_production_lot_tree"/> |
| 47 |
<field name="arch" type="xml"> |
| 48 |
<xpath expr="//field[@name='create_date']" position="after"> |
| 49 |
<field name="product_qty" column_invisible="True"/> |
| 50 |
<field name="alert_date" optional="hide" widget='remaining_days' invisible="product_qty <= 0"/> |
| 51 |
<field name="use_date" optional="hide"/> |
| 52 |
<field name="removal_date" optional="hide"/> |
| 53 |
<field name="expiration_date" optional="hide"/> |
| 54 |
</xpath> |
| 55 |
</field> |
| 56 |
</record> |
| 57 |
|
| 58 |
<record id="view_production_lot_view_kanban" model="ir.ui.view"> |
| 59 |
<field name="name">stock.production.lot.kanban.inherit.product.expiry</field> |
| 60 |
<field name="model">stock.lot</field> |
| 61 |
<field name="inherit_id" ref="stock.view_production_lot_kanban"/> |
| 62 |
<field name="arch" type="xml"> |
| 63 |
<xpath expr="//templates" position="before"> |
| 64 |
<field name="product_qty"/> |
| 65 |
<field name="product_expiry_alert"/> |
| 66 |
</xpath> |
| 67 |
<xpath expr="//field[@name='name']" position="after"> |
| 68 |
<div> |
| 69 |
<span title="Alert" class="fa fa-exclamation-triangle text-danger me-2" |
| 70 |
invisible="product_qty <= 0 or not product_expiry_alert or not expiration_date"/> |
| 71 |
<field name="alert_date" widget='remaining_days' class="d-inline-block"/> |
| 72 |
</div> |
| 73 |
</xpath> |
| 74 |
<xpath expr="//field[@name='product_id']" position="after"> |
| 75 |
<div invisible="not expiration_date"> |
| 76 |
<div> |
| 77 |
<label for="expiration_date">Expiration: </label> |
| 78 |
<field class="ms-2" name="expiration_date"/> |
| 79 |
</div> |
| 80 |
<div> |
| 81 |
<label for="removal_date">Removal: </label> |
| 82 |
<field class="ms-2" name="removal_date"/> |
| 83 |
</div> |
| 84 |
</div> |
| 85 |
</xpath> |
| 86 |
</field> |
| 87 |
</record> |
| 88 |
</odoo> |