summaryrefslogtreecommitdiff
path: root/addons/product_expiry/views/stock_quant_views.xml
blob: d15b1437b2c840f48028a45e14781fd6d52c6833 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?xml version="1.0" encoding='UTF-8'?>
<odoo>
        <record id="view_quant_form_expiry" model="ir.ui.view">
            <field name="name">stock.quant.inherit.form</field>
            <field name="model">stock.quant</field>
            <field name="inherit_id" ref="stock.view_stock_quant_form"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='lot_id']" position="after" >
                    <field name="removal_date"/>
                </xpath>
            </field>
        </record>

    <record id="view_stock_quant_tree_expiry" model="ir.ui.view">
        <field name="name">stock.quant.inherit.form</field>
        <field name="model">stock.quant</field>
        <field name="inherit_id" ref="stock.view_stock_quant_tree"/>
        <field name="arch" type="xml">
            <xpath expr="//tree" position="attributes">
                <attribute name="decoration-danger">
                    removal_date &lt; current_date or quantity &lt; 0
                </attribute>
            </xpath>
            <xpath expr="//field[@name='quantity']" position="after" >
                <field name="removal_date"/>
            </xpath>
        </field>
    </record>

    <record id="view_stock_quant_tree_editable_expiry" model="ir.ui.view">
        <field name="name">stock.quant.inherit.form</field>
        <field name="model">stock.quant</field>
        <field name="inherit_id" ref="stock.view_stock_quant_tree_editable"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='inventory_quantity']" position="before">
                <field name="use_expiration_date" invisible="1"/>
                <field name="removal_date" optional="show"
                    invisible="context.get('hide_removal_date')" attrs="{'readonly': ['|', ('tracking', '=', 'none'), ('use_expiration_date', '=', False)]}"/>
            </xpath>
        </field>
    </record>

    <record id="quant_search_view_inherit_product_expiry" model="ir.ui.view">
        <field name="name">stock.quant.search.inherit</field>
        <field name="model">stock.quant</field>
        <field name="inherit_id" ref="stock.quant_search_view"/>
        <field name="arch" type="xml">
            <xpath expr="//filter[@name='reserved']" position="after">
                <separator/>
                <filter string="Expiration Alerts" name="expiration_alerts"
                    domain="[('removal_date', '&lt;=', context_today().strftime('%Y-%m-%d'))]"/>
            </xpath>
        </field>
     </record>
</odoo>