<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <template id="exception_on_po">
        <div>
          Exception(s) occurred on the purchase order(s):
          <t t-foreach="purchase_order_ids" t-as="purchase_order">
              <a href="#" data-oe-model="purchase.order" t-att-data-oe-id="purchase_order.id"><t t-out="purchase_order.name"/></a>.
          </t>
          Manual actions may be needed.
          <div class="mt16">
              <p>Exception(s):</p>
              <ul t-foreach="order_exceptions" t-as="exception">
                  <li>
                      <t t-set="order_line" t-value="exception[0]"/>
                      <t t-set="new_qty" t-value="exception[1][0]"/>
                      <t t-set="old_qty" t-value="exception[1][1]"/>
                      <t t-out="new_qty"/> <t t-out="order_line.uom_id.name"/> of <t t-out="order_line.product_id.name"/>
                      ordered instead of <t t-out="old_qty"/> <t t-out="order_line.uom_id.name"/>
                  </li>
              </ul>
          </div>
          <div class="mt16" t-if="impacted_pickings">
              <p>Next transfer(s) impacted:</p>
              <ul t-foreach="impacted_pickings" t-as="picking">
                  <li><a href="#" data-oe-model="stock.picking" t-att-data-oe-id="picking.id"><t t-out="picking.name"/></a></li>
              </ul>
          </div>
        </div>
    </template>

    <template id="exception_on_picking">
        <div>
            Received quantity is less than the expected quantity for transfer
            <a href="#" data-oe-model="stock.picking" t-att-data-oe-id="origin_picking.id"><t t-out="origin_picking.name"/></a> and no backorder is planned. Manual action may be needed.
            <div class="mt16">
                <ul t-foreach="moves_information" t-as="exception">
                    <t t-set="move" t-value="exception[0]"/>
                    <t t-set="new_qty" t-value="exception[1][0]"/>
                    <t t-set="old_qty" t-value="exception[1][1]"/>
                    <li>
                        Only <t t-out="new_qty"/> <t t-out="move.uom_id.name"/>
                        of <t t-out="move.product_id.display_name"/>
                        received in contrast to the expected <t t-out="old_qty"/> <t t-out="move.uom_id.name"/>
                    </li>
                </ul>
            </div>
        </div>
    </template>
</odoo>
