<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
    <record id="lunch_order_mail_supplier" model="mail.template">
        <field name="name">Lunch: Supplier Order</field>
        <field name="model_id" ref="lunch.model_lunch_supplier"/>
        <field name="email_from">{{ ctx.get('order', {}).get('email_from') }}</field>
        <field name="partner_to">{{ ctx.get('order', {}).get('supplier_id') }}</field>
        <field name="use_default_to" eval="False"/>
        <field name="subject">Orders for {{ ctx.get('order', {}).get('company_name') }}</field>
        <field name="lang">{{ ctx.get('default_lang') }}</field>
        <field name="description">Sent to vendor with the order of the day</field>
        <field name="email_layout_xmlid">mail.mail_notification_layout</field>
        <field name="email_layout_force_header" eval="True"/>
        <field name="email_layout_force_footer" eval="True"/>
        <field name="body_html" type="html"><t>
<t t-set="lines" t-value="ctx.get('lines', [])"/>
<t t-set="order" t-value="ctx.get('order', {})"/>
<t t-set="currency" t-value="user.env['res.currency'].browse(order.get('currency_id'))"/>
<p>
Dear <t t-out="order.get('supplier_name', '')">Laurie Poiret</t>,
</p><p>
Here is, today orders for <t t-out="order.get('company_name', '')">LunchCompany</t>:
</p>

<t t-if="sites">
    <br/>
    <p>Location</p>
    <p t-foreach="site" t-as="site">
        <t t-out="site['name'] or ''"></t> : <t t-out="site['address'] or ''"></t>
    </p>
    <br/>
</t>

<table>
    <thead>
        <tr style="background-color:rgb(233,232,233);">
            <th style="width: 100%; min-width: 96px; font-size: 13px;"><strong>Product</strong></th>
            <th style="width: 100%; min-width: 96px; font-size: 13px;"><strong>Comments</strong></th>
            <th style="width: 100%; min-width: 96px; font-size: 13px;"><strong>Person</strong></th>
            <th style="width: 100%; min-width: 96px; font-size: 13px;"><strong>Site</strong></th>
            <th style="width: 100%; min-width: 96px; font-size: 13px;" align="center"><strong>Qty</strong></th>
            <th style="width: 100%; min-width: 96px; font-size: 13px;" align="center"><strong>Price</strong></th>
        </tr>
    </thead>
    <tbody>
        <tr t-foreach="lines" t-as="line">
            <td style="width: 100%; font-size: 13px;" valign="top" t-out="line['product'] or ''">Sushi salmon</td>
            <td style="width: 100%; font-size: 13px;" valign="top">
            <t t-if="line['toppings']">
                <t t-out="line['toppings'] or ''">Soy sauce</t>
            </t>
            <t t-if="line['note']">
                <div style="color: rgb(173,181,189);" t-out="line['note'] or ''">With wasabi.</div>
            </t>
            </td>
            <td style="width: 100%; font-size: 13px;" valign="top" t-out="line['username'] or ''">lap</td>
            <td style="width: 100%; font-size: 13px;" valign="top" t-out="line['site'] or ''">Office 1</td>
            <td style="width: 100%; font-size: 13px;" valign="top" align="right" t-out="line['quantity'] or ''">10</td>
            <td style="width: 100%; font-size: 13px;" valign="top" align="right" t-out="format_amount(line['price'], currency) or ''">$ 1.00</td>
        </tr>
        <tr>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td style="width: 100%; font-size: 13px; border-top: 1px solid black;"><strong>Total</strong></td>
            <td style="width: 100%; font-size: 13px; border-top: 1px solid black;" align="right"><strong t-out="order.get('amount_total') and format_amount(order['amount_total'], currency) or ''">$ 10.00</strong></td>
        </tr>
    </tbody>
</table>

<p>Do not hesitate to contact us if you have any questions.</p>
        </t></field>
    </record>

</data></odoo>
