<?xml version="1.0" ?>
<odoo>
    <!--  Make Procurement with security access right -->
    <record id="view_make_procurement_buffer_wizard" model="ir.ui.view">
        <field name="name">Request Procurement</field>
        <field name="model">make.procurement.buffer</field>
        <field name="arch" type="xml">
            <form string="Procurement Request">
                <p class="oe_gray">
                    Use this assistant to generate a procurement request for this
                    stock buffer. According to the product configuration,
                    this may trigger a draft purchase order, a manufacturing
                    order or a transfer picking.
                </p>
                <p class="oe_gray">
                    By default, the qty is equal to the recommended quantity.
                    For distributed buffers, when the option on the profile is active,
                    the quantity is limited to the free quantity.
                </p>
                <group>
                    <field
                        name="partner_id"
                        readonly="1"
                        attrs="{'invisible': [('partner_id','=',False)]}"
                    />
                </group>
                <field name="item_ids" nolabel="1">
                    <tree nocreate="1" editable="top">
                        <field name="buffer_id" invisible="True" />
                        <field
                            name="warehouse_id"
                            invisible="1"
                            groups="!stock.group_stock_multi_locations"
                        />
                        <field
                            name="location_id"
                            invisible="1"
                            groups="!stock.group_stock_multi_locations"
                        />
                        <field
                            name="warehouse_id"
                            groups="stock.group_stock_multi_locations"
                        />
                        <field
                            name="location_id"
                            groups="stock.group_stock_multi_locations"
                        />
                        <field name="product_id" />
                        <field name="recommended_qty" />
                        <field
                            name="qty"
                            readonly="1"
                            force_save="1"
                            groups="!ddmrp.group_change_buffer_procure_qty"
                        />
                        <field
                            name="qty"
                            groups="ddmrp.group_change_buffer_procure_qty"
                        />
                        <field name="uom_id" groups="uom.group_uom" />
                        <field name="date_planned" />
                    </tree>
                </field>
                <footer>
                    <button
                        string="Execute"
                        name="make_procurement"
                        type="object"
                        class="btn-primary"
                    />
                    <button string="Cancel" class="btn-default" special="cancel" />
                </footer>
            </form>
        </field>
    </record>
    <record id="act_make_procurement_from_buffer" model="ir.actions.act_window">
        <field name="name">Request Procurement</field>
        <field name="res_model">make.procurement.buffer</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
        <field name="binding_model_id" ref="ddmrp.model_stock_buffer" />
        <field name="view_id" ref="ddmrp.view_make_procurement_buffer_wizard" />
    </record>
</odoo>
