summaryrefslogtreecommitdiff
path: root/addons/stock/views/product_views.xml
diff options
context:
space:
mode:
Diffstat (limited to 'addons/stock/views/product_views.xml')
-rw-r--r--addons/stock/views/product_views.xml421
1 files changed, 421 insertions, 0 deletions
diff --git a/addons/stock/views/product_views.xml b/addons/stock/views/product_views.xml
new file mode 100644
index 00000000..443fdeae
--- /dev/null
+++ b/addons/stock/views/product_views.xml
@@ -0,0 +1,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>