<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<record id="view_picking_withcarrier_out_form" model="ir.ui.view">
  <field name="name">delivery.stock.picking.out.form</field>
  <field name="model">stock.picking</field>
  <field name="inherit_id" ref="base_delivery_carrier_label.view_picking_withcarrier_out_form"/>
  <field name="arch" type="xml">
    <field name="option_ids" position="after">
      <separator string="Delivery instructions" attrs="{'invisible': [('delivery_type', '!=', 'postlogistics')]}"/>
      <group>
        <group name="delivery_instructions" attrs="{'invisible': [('delivery_type', '!=', 'postlogistics')]}">
          <field name="delivery_fixed_date"/>
          <field name="delivery_place"/>
          <field name="delivery_phone"/>
          <field name="delivery_mobile"/>
        </group>
      </group>
    </field>
    <xpath expr="//button[@name='action_generate_carrier_label']" position="attributes">
      <attribute name="attrs">{'invisible': ['|', '&amp;', ('picking_type_code', '!=', 'incoming'), ('state', '!=', 'done'), '&amp;', ('picking_type_code', '=', 'incoming'), ('state', 'not in',  ('assigned', 'done'))]}
      </attribute>
    </xpath>
  </field>
</record>

</odoo>
