<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record id="view_stock_picking_batch_summary_line_tree" model="ir.ui.view">
        <field name="name">stock.picking.batch.summary.line.tree</field>
        <field name="model">stock.picking.batch.summary.line</field>
        <field name="arch" type="xml">
            <list create="0" delete="0" default_order="product_categ_id,product_id">
                <field name="product_categ_id" readonly="1"/>
                <field name="product_id" readonly="1" context="{'display_default_code': False}"/>
                <field name="product_default_code" readonly="1" optional="hide"/>
                <field name="product_uom_id" readonly="1" optional="hide"/>
                <field name="qty_demanded" readonly="1"/>
                <field name="qty_done" readonly="1"/>
                <field name="qty_pending" readonly="1"/>
                <field name="is_collected" widget="boolean_toggle" nolabel="1"/>
            </list>
        </field>
    </record>

    <record id="view_move_line_batch_operator" model="ir.ui.view">
        <field name="name">stock.move.line.batch.operator</field>
        <field name="model">stock.move.line</field>
        <field name="arch" type="xml">
            <list create="0" delete="1" editable="bottom"
                  default_order="product_categ_id,product_id,picking_partner_id"
                  class="o_batch_operator_list">
                <field name="batch_id" column_invisible="True"/>
                <field name="product_categ_id" readonly="1" optional="show"/>
                <field name="product_id" readonly="1"
                       context="{'display_default_code': False}"/>
                <field name="reference" readonly="1" optional="hide"/>
                <field name="picking_partner_id" readonly="1" optional="show"/>
                <field name="home_delivery" readonly="1" widget="boolean_toggle" optional="show"/>
                <field name="consumer_group_id" readonly="1" optional="show"/>
                <field name="quantity" string="Cant."/>
                <field name="is_collected" widget="boolean_toggle"/>
            </list>
        </field>
    </record>

    <record id="view_stock_picking_batch_form_inherit_summary" model="ir.ui.view">
        <field name="name">stock.picking.batch.form.summary</field>
        <field name="model">stock.picking.batch</field>
        <field name="inherit_id" ref="stock_picking_batch.stock_picking_batch_form"/>
        <field name="arch" type="xml">
            <xpath expr="//button[@name='action_done']" position="before">
                <button name="action_open_operator_view"
                        string="Basket Assembly"
                        type="object"
                        class="btn-secondary"
                        invisible="state != 'in_progress'"/>
            </xpath>
            <xpath expr="//notebook/page[@name='page_detailed_operations']" position="after">
                <page string="Product Summary" name="page_product_summary">
                    <field name="summary_line_ids" context="{'tree_view_ref': 'stock_picking_batch_custom.view_stock_picking_batch_summary_line_tree'}"/>
                </page>
            </xpath>
        </field>
    </record>

    <record id="view_stock_picking_batch_picking_tree_consumer_group" model="ir.ui.view">
        <field name="name">stock.picking.batch.picking.tree.consumer.group</field>
        <field name="model">stock.picking</field>
        <field name="inherit_id" ref="stock_picking_batch.stock_picking_view_batch_tree_ref"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='partner_id']" position="after">
                <field name="batch_consumer_group_id" optional="show"/>
            </xpath>
        </field>
    </record>

    <record id="view_move_line_tree_inherit_batch_custom" model="ir.ui.view">
        <field name="name">stock.move.line.list.batch.custom</field>
        <field name="model">stock.move.line</field>
        <field name="inherit_id" ref="stock_picking_batch.view_move_line_tree"/>
        <field name="arch" type="xml">
            <xpath expr="//list" position="attributes">
                <attribute name="default_order">product_categ_id,product_id,picking_partner_id</attribute>
                <attribute name="class">o_batch_move_line_list</attribute>
            </xpath>
            <xpath expr="//field[@name='product_id']" position="before">
                <field name="product_categ_id" readonly="1"/>
            </xpath>
            <xpath expr="//field[@name='product_id']" position="attributes">
                <attribute name="context">{'display_default_code': False}</attribute>
            </xpath>
            <xpath expr="//field[@name='product_id']" position="after">
                <field name="picking_partner_id" readonly="1" optional="show"/>
                <field name="product_default_code" readonly="1" optional="hide"/>
                <field name="home_delivery" readonly="1" widget="boolean_toggle" optional="show"/>
                <field name="consumer_group_id" readonly="1" optional="show"/>
                <field name="is_collected" widget="boolean_toggle" optional="show"/>
            </xpath>
            <xpath expr="//field[@name='product_uom_id']" position="attributes">
                <attribute name="optional">hide</attribute>
            </xpath>
            <xpath expr="//field[@name='company_id'][@groups='base.group_multi_company']" position="attributes">
                <attribute name="optional">hide</attribute>
            </xpath>
            <xpath expr="//field[@name='picking_id']" position="attributes">
                <attribute name="optional">hide</attribute>
            </xpath>
            <xpath expr="//field[@name='location_id']" position="attributes">
                <attribute name="optional">hide</attribute>
            </xpath>
            <xpath expr="//field[@name='location_dest_id']" position="attributes">
                <attribute name="optional">hide</attribute>
            </xpath>
        </field>
    </record>

    <!-- assets: moved to manifest 'assets' declaration -->
</odoo>
