summaryrefslogtreecommitdiff
path: root/addons/stock/views/product_views.xml
blob: 443fdeaeb56846ce74fbc0de9a0b98c2ce74dad7 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>

        <record id="product_category_form_view_inherit" model="ir.ui.view">
            <field name="name">product.category.form</field>
            <field name="model">product.category</field>
            <field name="inherit_id" ref="product.product_category_form_view" />
            <field name="arch" type="xml">
                <div name="button_box" position="inside">
                    <button string="Putaway Rules"
                        class="oe_stat_button"
                        icon="fa-random" name="%(category_open_putaway)d" type="action"
                        groups="stock.group_stock_multi_locations"/>
                </div>
                <group name="first" position="after">
                    <group string="Logistics">
                        <field name="route_ids" widget="many2many_tags" groups="stock.group_adv_location"/>
                        <field name="total_route_ids" widget="many2many_tags" groups="stock.group_adv_location" attrs="{'invisible': [('parent_id', '=', False)]}"/>
                        <field name="removal_strategy_id" options="{'no_create': True}"/>
                    </group>
                </group>
            </field>
        </record>

        <record model="ir.actions.server" id="action_open_routes">
            <field name="name">Routes</field>
            <field name="model_id" ref="product.model_product_template"/>
            <field name="groups_id" eval="[(4,ref('stock.group_stock_user'))]"/>
            <field name="state">code</field>
            <field name="code">
                action = model.action_open_routes_diagram()
            </field>
        </record>

        <record id="view_stock_product_tree" model="ir.ui.view">
            <field name="name">product.stock.tree.inherit</field>
            <field name="model">product.product</field>
            <field name="inherit_id" ref="product.product_product_tree_view"/>
            <field name="arch" type="xml">
                <field name="price" position="after">
                    <field name="qty_available" attrs="{'invisible':[('type', '!=', 'product')]}" optional="show" decoration-danger="virtual_available &lt; 0" decoration-warning="virtual_available == 0" decoration-bf="1"/>
                    <field name="virtual_available" attrs="{'invisible':[('type', '!=', 'product')]}" string="Forecasted Quantity" optional="show" decoration-danger="virtual_available &lt; 0" decoration-warning="virtual_available == 0"/>
                </field>
            </field>
        </record>

        <record id="view_stock_product_template_tree" model="ir.ui.view">
            <field name="name">product.template.stock.tree.inherit</field>
            <field name="model">product.template</field>
            <field name="inherit_id" ref="product.product_template_tree_view"/>
            <field name="arch" type="xml">
                <field name="uom_id" position="before">
                    <field name="qty_available" attrs="{'invisible':[('type', '!=', 'product')]}" optional="show" decoration-danger="qty_available &lt; 0"/>
                    <field name="virtual_available" attrs="{'invisible':[('type', '!=', 'product')]}" optional="show" decoration-danger="virtual_available &lt; 0" decoration-bf="1"/>
                </field>
                <field name="default_code" position="after">
                    <field name="responsible_id" widget="many2one_avatar_user"/>
                </field>
            </field>
        </record>

        <!-- Product Template -->

        <record id="product_template_search_form_view_stock" model="ir.ui.view">
            <field name="name">product.template.search.stock.form</field>
            <field name="model">product.template</field>
            <field name="mode">primary</field>
            <field name="inherit_id" ref="product.product_template_search_view"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='pricelist_id']" position="after">
                    <separator/>
                    <field name="location_id" context="{'location': self}" filter_domain="[]"/>
                    <field name="warehouse_id" context="{'warehouse': self}" filter_domain="[]"/>
                    <separator/>
                    <filter name="real_stock_available" string="Available Products" domain="[('qty_available','&gt;',0)]"/>
                    <filter name="real_stock_negative" string="Negative Forecasted Quantity" domain="[('virtual_available','&lt;',0)]"/>
                </xpath>
            </field>
        </record>

        <record id="stock_product_search_form_view" model="ir.ui.view">
            <field name="name">product.product.search.stock.form</field>
            <field name="model">product.product</field>
            <field name="mode">primary</field>
            <field name="inherit_id" ref="product.product_search_form_view"/>
            <field name="arch" type="xml">
                <xpath expr="//filter[@name='inactive']" position="after">
                    <separator/>
                    <filter name="real_stock_available" string="Available Products" domain="[('qty_available','&gt;',0)]"/>
                    <filter name="real_stock_negative" string="Negative Forecasted Quantity" domain="[('virtual_available','&lt;',0)]"/>
                </xpath>
            </field>
        </record>

        <!-- view common to both template and product -->
        <record id="view_template_property_form" model="ir.ui.view">
            <field name="name">product.template.stock.property.form.inherit</field>
            <field name="model">product.template</field>
            <field name="inherit_id" ref="product.product_template_form_view"/>
            <field name="arch" type="xml">
                <xpath expr="//group[@name='group_lots_and_weight']" position="inside">
                    <label for="sale_delay" attrs="{'invisible': [('sale_ok', '=', False)]}"/>
                    <div attrs="{'invisible': [('sale_ok', '=', False)]}">
                        <field name="sale_delay" class="oe_inline" style="vertical-align:baseline"/> days
                    </div>
                </xpath>
                <xpath expr="//group[@name='group_lots_and_weight']" position="before">
                    <field name="has_available_route_ids" invisible="1"/>
                    <group string="Operations" name="operations">
                        <label for="route_ids" attrs="{'invisible': [('type', 'in', ['service', 'digital'])]}"/>
                        <div>
                            <field name="route_ids" class="mb-0" widget="many2many_checkboxes" attrs="{'invisible': ['|', ('has_available_route_ids', '=', False), ('type', 'in', ['service', 'digital'])]}"/>
                            <button id="stock.view_diagram_button" string="View Diagram" type="action" name="%(action_open_routes)d" icon="fa-arrow-right"
                                 attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"
                                 class="btn btn-link pt-0" context="{'default_product_tmpl_id': id}"/>
                        </div>
                        <field name="route_from_categ_ids" widget="many2many_tags" readonly="1" attrs="{'invisible': [('route_from_categ_ids', '=', [])]}"/>
                    </group>
                </xpath>
                <xpath expr="//group[@name='group_lots_and_weight']" position="after">
                    <group string="Traceability" name="traceability" groups="stock.group_production_lot"
                           attrs="{'invisible': [('type', '=', 'consu')]}">
                        <field name="tracking" widget="radio" attrs="{'invisible': [('type', 'in', ['service', 'digital'])]}"/>
                    </group>
                     <group string="Counterpart Locations" name="stock_property" groups="base.group_no_one">
                        <field name="property_stock_production"/>
                        <field name="property_stock_inventory"/>
                    </group>
                </xpath>
                <page name="inventory" position="inside">
                    <group string="Description for Delivery Orders">
                        <field name="description_pickingout" nolabel="1" placeholder="This note is added to delivery orders."/>
                    </group>
                    <group string="Description for Receipts">
                        <field name="description_pickingin" nolabel="1" placeholder="This note is added to receipt orders (e.g. where to store the product in the warehouse)."/>
                    </group>
                    <group string="Description for Internal Transfers" groups="stock.group_stock_multi_locations">
                        <field name="description_picking" placeholder="This note is added to internal transfer orders (e.g. where to pick the product in the warehouse)." nolabel="1"/>
                    </group>
                </page>
                <page name="inventory" position="attributes">
                    <attribute name="groups">stock.group_stock_user,product.group_stock_packaging</attribute>
                </page>
            </field>
        </record>

        <record model="ir.ui.view" id="product_template_kanban_stock_view">
            <field name="name">Product Template Kanban Stock</field>
            <field name="model">product.template</field>
            <field name="inherit_id" ref="product.product_template_kanban_view"/>
            <field name="arch" type="xml">
                <xpath expr="//kanban" position="inside">
                    <field name="type"/>
                </xpath>
                <xpath expr="//div[@name='product_lst_price']" position="after">
                    <div t-if="record.type.raw_value == 'product'">On hand: <field name="qty_available"/> <field name="uom_id"/></div>
                </xpath>
            </field>
        </record>

        <!-- Product Variant -->

        <record id="product_search_form_view_stock" model="ir.ui.view">
            <field name="name">product.search.stock.form</field>
            <field name="model">product.product</field>
            <field name="inherit_id" ref="product.product_search_form_view"/>
            <field name="arch" type="xml">
                <field name="pricelist_id" position="before">
                    <field name="location_id" options="{'no_create': True}" context="{'location': self}"/>
                    <field name="warehouse_id" context="{'warehouse': self}"/>
                </field>
            </field>
        </record>

        <record id="product_product_view_form_easy_inherit_stock" model="ir.ui.view">
            <field name="name">product.product.view.form.easy.inherit.stock</field>
            <field name="model">product.product</field>
            <field name="inherit_id" ref="product.product_variant_easy_edit_view"/>
            <field name="arch" type="xml">
                <sheet position="before">
                    <header>
                        <button string="Update Quantity" type="object"
                            groups="stock.group_stock_manager"
                            name="action_update_quantity_on_hand"
                            attrs="{'invisible': [('type', '!=', 'product')]}"/>
                        <button string="Replenish" type="action"
                            name="%(action_product_replenish)d"
                            context="{'default_product_id': id}"
                            groups="stock.group_stock_user"
                            attrs="{'invisible': [('type', '!=', 'product')]}"/>
                    </header>
                </sheet>
                <div name="button_box" position="inside">
                    <button string="Putaway Rules" type="object"
                        name="action_view_related_putaway_rules"
                        class="oe_stat_button" icon="fa-random" groups="stock.group_stock_multi_locations"
                        attrs="{'invisible': [('type', '=', 'service')]}"
                        context="{'invisible_handle': True, 'single_product': True}"/>
                </div>
            </field>
        </record>

        <!-- view used for product.product only -->
        <record model="ir.ui.view" id="product_form_view_procurement_button">
            <field name="name">product.product.procurement</field>
            <field name="model">product.product</field>
            <field name="groups_id" eval="[(4, ref('stock.group_stock_user'))]"/>
            <field name="inherit_id" ref="product.product_normal_form_view"/>
            <field name="arch" type="xml">
                <data>
                    <header position="inside">
                        <button string="Update Quantity" type="object"
                            groups="stock.group_stock_manager"
                            name="action_update_quantity_on_hand"
                            attrs="{'invisible': [('type', '!=', 'product')]}"/>
                        <button string="Replenish" type="action"
                            name="%(action_product_replenish)d"
                            context="{'default_product_id': id}"
                            groups="stock.group_stock_user"
                            attrs="{'invisible': [('type', '!=', 'product')]}"/>
                    </header>
                    <div name="button_box" position="inside">
                        <button class="oe_stat_button"
                               name="action_open_quants"
                               icon="fa-cubes"
                               type="object" attrs="{'invisible':[('type', '!=', 'product')]}">
                               <div class="o_field_widget o_stat_info">
                                    <span class="o_stat_value">
                                        <field name="qty_available" widget="statinfo" nolabel="1" class="mr4"/>
                                        <field name="uom_name"/>
                                    </span>
                                    <span class="o_stat_text">On Hand</span>
                               </div>
                        </button>
                        <button type="object"
                            name="action_product_forecast_report"
                            attrs="{'invisible':[('type', '!=', 'product')]}"
                            context="{'default_product_id': id}"
                            class="oe_stat_button" icon="fa-cubes">
                            <div class="o_field_widget o_stat_info">
                                <span class="o_stat_value">
                                    <field name="virtual_available" widget="statinfo" nolabel="1" class="mr4"/>
                                    <field name="uom_name"/>
                                </span>
                                <span class="o_stat_text">Forecasted</span>
                            </div>
                        </button>
                       <button string="Product Moves"
                            type="object"
                            name= "action_view_stock_move_lines"
                            attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"
                            class="oe_stat_button" icon="fa-exchange"
                            groups="stock.group_stock_user"/>
                        <button name="action_view_orderpoints" type="object"
                            attrs="{'invisible':['|',('type', 'not in', ['product', 'consu']),('nbr_reordering_rules', '!=', 1)]}"
                            class="oe_stat_button" icon="fa-refresh">
                            <div class="o_field_widget o_stat_info mr4">
                                <span class="o_stat_text">Min :</span>
                                <span class="o_stat_text">Max:</span>
                            </div>
                            <div class="o_field_widget o_stat_info">
                                <span class="o_stat_value"><field name="reordering_min_qty"/></span>
                                <span class="o_stat_value"><field name="reordering_max_qty"/></span>
                            </div>
                        </button>
                        <button type="object"
                            name="action_view_orderpoints"
                            attrs="{'invisible':['|',('type', '!=', 'product'),('nbr_reordering_rules', '==', 1)]}"
                            class="oe_stat_button" icon="fa-refresh">
                            <field name="nbr_reordering_rules" widget="statinfo"/>
                        </button>
                        <button string="Lot/Serial Numbers" type="object"
                            name="action_open_product_lot"
                            attrs="{'invisible': [('tracking', '=', 'none')]}"
                            class="oe_stat_button" icon="fa-bars" groups="stock.group_production_lot"/>
                        <button string="Putaway Rules" type="object"
                            name="action_view_related_putaway_rules"
                            class="oe_stat_button" icon="fa-random" groups="stock.group_stock_multi_locations"
                            attrs="{'invisible': [('type', '=', 'service')]}"
                            context="{'invisible_handle': True, 'single_product': True}"/>
                    </div>
                    <xpath expr="//button[@name='%(action_open_routes)d']" position="attributes">
                        <attribute name="context">
                            {'default_product_id': id}
                        </attribute>
                    </xpath>
                </data>
            </field>
        </record>

        <!-- view used for product.template only -->
        <record model="ir.ui.view" id="product_template_form_view_procurement_button">
            <field name="name">product.template_procurement</field>
            <field name="model">product.template</field>
            <field name="groups_id" eval="[(4, ref('stock.group_stock_user'))]"/>
            <field name="inherit_id" ref="product.product_template_only_form_view"/>
            <field name="arch" type="xml">
                <data>
                    <header position="inside" >
                        <button string="Update Quantity" type="object"
                            groups="stock.group_stock_manager"
                            name="action_update_quantity_on_hand"
                            attrs="{'invisible': [('type', '!=', 'product')]}"/>
                        <button string="Replenish" type="action"
                            name="%(action_product_replenish)d"
                            context="{'default_product_tmpl_id': id}"
                            groups="stock.group_stock_user"
                            attrs="{'invisible': [('type', '!=', 'product')]}"/>
                    </header>
                    <div name="button_box" position="inside">
                        <button type="object"
                            name="action_open_quants"
                            attrs="{'invisible':[('type', '!=', 'product')]}"
                            class="oe_stat_button" icon="fa-cubes">
                            <div class="o_field_widget o_stat_info">
                                <span class="o_stat_value" widget="statinfo">
                                    <field name="qty_available" widget="statinfo" nolabel="1" class="mr4"/>
                                    <field name="uom_name"/>
                                </span>
                                <span class="o_stat_text">On Hand</span>
                            </div>
                        </button>
                        <button type="object"
                            name="action_product_tmpl_forecast_report"
                            attrs="{'invisible':[('type', '!=', 'product')]}"
                            context="{'default_product_tmpl_id': id}"
                            class="oe_stat_button" icon="fa-cubes">
                            <div class="o_field_widget o_stat_info">
                                <span class="o_stat_value">
                                    <field name="virtual_available" widget="statinfo" nolabel="1" class="mr4"/>
                                    <field name="uom_name"/>
                                </span>
                                <span class="o_stat_text">Forecasted</span>
                            </div>
                        </button>
                        <button string="Product Moves" type="object"
                            name= "action_view_stock_move_lines"
                            attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"
                            class="oe_stat_button" icon="fa-exchange"
                            groups="stock.group_stock_user"/>
                        <button type="object"
                            name="action_view_orderpoints"
                            attrs="{'invisible':['|',('type', '!=', 'product'),('nbr_reordering_rules', '!=', 1)]}"
                            class="oe_stat_button" icon="fa-refresh">
                            <div class="o_field_widget o_stat_info mr4">
                                <span class="o_stat_text">Min:</span>
                                <span class="o_stat_text">Max:</span>
                            </div>
                            <div class="o_field_widget o_stat_info">
                                <span class="o_stat_value"><field name="reordering_min_qty"/></span>
                                <span class="o_stat_value"><field name="reordering_max_qty"/></span>
                            </div>
                        </button>
                        <button type="object"
                            name="action_view_orderpoints"
                            attrs="{'invisible':['|',('type', '!=', 'product'),('nbr_reordering_rules', '==', 1)]}"
                            class="oe_stat_button"
                            icon="fa-refresh">
                            <field name="nbr_reordering_rules" widget="statinfo"/>
                         </button>
                        <button string="Lot/Serial Numbers" type="object"
                            name="action_open_product_lot"
                            attrs="{'invisible': [('tracking', '=', 'none')]}"
                            class="oe_stat_button" icon="fa-bars" groups="stock.group_production_lot"/>
                        <button string="Putaway Rules" type="object"
                            name="action_view_related_putaway_rules"
                            class="oe_stat_button" icon="fa-random" groups="stock.group_stock_multi_locations"
                            attrs="{'invisible': [('type', '=', 'service')]}"
                            context="{
                                'invisible_handle': True,
                                'single_product': product_variant_count == 1,
                            }"/>
                    </div>

                    <!-- change attrs of fields added in view_template_property_form
                    to restrict the display for templates -->
                    <xpath expr="//group[@name='group_lots_and_weight']" position="attributes">
                        <attribute name="attrs">{'invisible': [('type', 'not in', ['product', 'consu'])]}</attribute>
                    </xpath>

                    <xpath expr="//label[@for='weight']" position="before">
                        <field name="responsible_id" domain="[('share', '=', False)]"/>
                    </xpath>
                </data>
            </field>
        </record>

    <record id="product_template_action_product" model="ir.actions.act_window">
        <field name="name">Products</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">product.template</field>
        <field name="view_mode">kanban,tree,form</field>
        <field name="search_view_id" ref="product_template_search_form_view_stock"/>
        <field name="context">{"search_default_consumable": 1, 'default_type': 'product'}</field>
        <field name="help" type="html">
            <p class="o_view_nocontent_smiling_face">
                No product found. Let's create one!
            </p><p>
                Track your stock quantities by creating storable products.
            </p>
        </field>
    </record>

    <record id="stock_product_normal_action" model="ir.actions.act_window">
        <field name="name">Product Variants</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">product.product</field>
        <field name="view_mode">tree,form,kanban</field>
        <field name="search_view_id" ref="stock_product_search_form_view"/>
    </record>

    <menuitem id="menu_product_variant_config_stock" name="Products" action="product_template_action_product"
        parent="stock.menu_stock_inventory_control" sequence="1"/>
    <menuitem id="product_product_menu" name="Product Variants" action="stock_product_normal_action"
        parent="menu_stock_inventory_control" sequence="2" groups="product.group_product_variant"/>
    <menuitem id="menu_product_packagings" name="Product Packagings" parent="stock.menu_product_in_config_stock" action="product.action_packaging_view" groups="product.group_stock_packaging"/>
    <menuitem id="menu_forecast_inventory" name="Forecasted Inventory" parent="stock.menu_warehouse_report" sequence="101" action="stock.report_stock_quantity_action"/>

    </data>
</odoo>