summaryrefslogtreecommitdiff
path: root/addons/stock/views/stock_production_lot_views.xml
blob: 135132d2bcee0bb8478a796d3e3f4f7ca05e3521 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="view_production_lot_form" model="ir.ui.view">
        <field name="name">stock.production.lot.form</field>
        <field name="model">stock.production.lot</field>
        <field name="priority">10</field>
        <field name="arch" type="xml">
            <form string="Lots/Serial Numbers">
                <sheet>
                <field name="display_complete" invisible="1"/>
                <div class="oe_button_box" name="button_box"
                     attrs="{'invisible': [('display_complete', '=', False)]}">
                        <button name="action_lot_open_quants" icon="fa-arrows" class="oe_stat_button" string="Location" type="object"/>
                        <button name="%(action_stock_report)d" icon="fa-arrow-up" class="oe_stat_button" string="Traceability" type="action"/>
                </div>
                <div class="oe_title">
                    <label for="name" class="oe_edit_only"/>
                    <h1>
                        <field name="name" placeholder="e.g. LOT/0001/20121"/>
                    </h1>
                </div>
                <group name="main_group">
                    <group>
                        <field name="product_id" context="{'default_type': 'product'}" readonly="context.get('set_product_readonly', False)" force_save="1" help="Product this lot/serial number contains. You cannot change it anymore if it has already been moved."/>
                        <label for="product_qty" attrs="{'invisible': [('display_complete', '=', False)]}"/>
                        <div class="o_row" attrs="{'invisible': [('display_complete', '=', False)]}">
                            <field name="product_qty"/>
                            <field name="product_uom_id" readonly="1" groups="uom.group_uom"/>
                        </div>
                        <field name="ref"/>
                        <field name="company_id" groups="base.group_multi_company"/>
                    </group>
                    <group></group>
                </group>
                <notebook attrs="{'invisible': [('display_complete', '=', False)]}">
                    <page string="Description" name="description">
                        <field name="note"/>
                    </page>
                </notebook>
                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids"/>
                    <field name="activity_ids"/>
                    <field name="message_ids"/>
                </div>
            </form>
        </field>
    </record>

    <record id="view_production_lot_tree" model="ir.ui.view">
        <field name="name">stock.production.lot.tree</field>
        <field name="model">stock.production.lot</field>
        <field name="arch" type="xml">
            <tree string="Lots/Serial Numbers" multi_edit="1">
                <field name="name" decoration-bf="1"/>
                <field name="ref" optional="show"/>
                <field name="product_id" readonly="1"/>
                <field name="create_date" optional="show"/>
                <field name="company_id" groups="base.group_multi_company"/>
            </tree>
        </field>
    </record>
    <record model="ir.ui.view" id="search_product_lot_filter">
        <field name="name">Production Lots Filter</field>
        <field name="model">stock.production.lot</field>
        <field name="arch" type="xml">
            <search string="Product Lots Filter">
                <field name="name" string="Lot/Serial Number" filter_domain="['|', ('name', 'ilike', self),('ref', 'ilike', self)]"/>
                <field name="product_id"/>
                <group expand="0" string="Group By">
                    <filter name="group_by_product" string="Product" domain="[]" context="{'group_by': 'product_id'}"/>
                </group>
            </search>
        </field>
    </record>

    <record id="action_production_lot_form" model="ir.actions.act_window">
        <field name="name">Lots/Serial Numbers</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">stock.production.lot</field>
        <field name="view_ids"
                   eval="[(5, 0, 0),
                          (0, 0, {'view_mode': 'tree', 'view_id': ref('view_production_lot_tree')}),
                          (0, 0, {'view_mode': 'form', 'view_id': ref('view_production_lot_form')})]"/>
        <field name="search_view_id" ref="search_product_lot_filter"/>
        <field name="context">{'search_default_group_by_product': 1, 'display_complete': True, 'default_company_id': allowed_company_ids[0]}</field>
        <field name="help" type="html">
          <p class="o_view_nocontent_smiling_face">
            Add a lot/serial number
          </p><p>
            Lots/Serial numbers help you tracking the path followed by your products.
            From their traceability report you will see the full history of their use, as well as their composition.
          </p>
        </field>
    </record>
    <menuitem action="action_production_lot_form" id="menu_action_production_lot_form"
        parent="menu_stock_inventory_control" groups="stock.group_production_lot"
        sequence="101"/>
</odoo>