<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="1">
        <record id="email_template_edi_sale" model="mail.template">
            <field name="name">Sales: Send Quotation</field>
            <field name="model_id" ref="sale.model_sale_order"/>
            <field name="subject">{{ object.company_id.name }} {{ object.state in ('draft', 'sent') and 'Quotation' or 'Order' }} {{ object.name or 'n/a' }}</field>
            <field name="email_from">{{ (object.user_id.email_formatted or object.company_id.email_formatted or user.email_formatted) }}</field>
            <field name="partner_to" eval="False"/>
            <field name="use_default_to" eval="True"/>
            <field name="description">Used by salespeople when they send quotations or proforma to prospects</field>
            <field name="email_layout_xmlid">mail.mail_notification_layout_with_responsible_signature</field>
            <field name="body_html" type="html">
<div style="margin: 0px; padding: 0px;">
    <p style="margin: 0px; padding: 0px; font-size: 13px;">
        <t t-set="doc_name" t-value="'quotation' if object.state in ('draft', 'sent') else 'order'"/>
        Hello,
        <br/><br/>
        Your <t t-out="doc_name or ''">quotation</t> <span style="font-weight: bold;" t-out="object.name or ''"></span>
        <t t-if="object.origin">
            (with reference: <t t-out="object.origin or ''">S00052</t> )
        </t>
        amounting in <span style="font-weight: bold;" t-out="format_amount(object.amount_total, object.currency_id) or ''">$ 10.00</span> is ready for review.
        <br/>
        <t t-set="documents" t-value="object._get_product_documents()"/>
        <t t-if="documents">
            <br/>
            <t t-if="len(documents)>1">
                Here are some additional documents that may interest you:
            </t>
            <t t-else="">
                Here is an additional document that may interest you:
            </t>
            <ul style="margin-bottom: 0;">
                <t t-foreach="documents" t-as="document">
                    <li style="font-size: 13px;">
                        <a t-out="document.ir_attachment_id.name"
                            t-att-href="object.get_portal_url('/document/' + str(document.id))"
                            t-att-target="target"/>
                    </li>
                </t>
            </ul>
        </t>
        <br/>
        Do not hesitate to contact us if you have any questions.
        <t t-if="not is_html_empty(object.user_id.signature)">
            <div>--<br/><t t-out="object.user_id.signature or ''">Mitchell Admin</t></div>
        </t>
    </p>
</div>
            </field>
            <field name="report_template_ids" eval="[(4, ref('sale.action_report_saleorder'))]"/>
            <field name="auto_delete" eval="True"/>
        </record>

        <record id="email_template_proforma" model="mail.template">
            <field name="name">Sales: Send Pro Forma</field>
            <field name="model_id" ref="sale.model_sale_order"/>
            <field name="subject">{{ object.company_id.name }} {{ object.state in ('draft', 'sent') and 'Pro Forma' or 'Order'}} (Ref {{ object.name or 'n/a' }})</field>
            <field name="email_from">{{ (object.user_id.email_formatted or object.company_id.email_formatted or user.email_formatted) }}</field>
            <field name="partner_to" eval="False"/>
            <field name="use_default_to" eval="True"/>
            <field name="description">Used by salespeople when they send pro forma to prospects</field>
            <field name="email_layout_xmlid">mail.mail_notification_layout_with_responsible_signature</field>
            <field name="body_html" type="html">
<div style="margin: 0px; padding: 0px;">
    <p style="margin: 0px; padding: 0px; font-size: 13px;">
        <t t-set="doc_name" t-value="'quotation' if object.state in ('draft', 'sent') else 'order'"/>
        Hello,
        <br/><br/>
        Your Pro Forma invoice for <t t-out="doc_name or ''">quotation</t> <span style="font-weight: bold;"  t-out="object.name or ''">S00052</span>
        <t t-if="object.origin">
            (with reference: <t t-out="object.origin or ''"></t> )
        </t>
        amounting in <span style="font-weight: bold;"  t-out="format_amount(object.amount_total, object.currency_id) or ''">$ 10.00</span> is available.
        <br/><br/>
        Do not hesitate to contact us if you have any questions.
        <t t-if="not is_html_empty(object.user_id.signature)">
            <div>--<br/><t t-out="object.user_id.signature or ''">Mitchell Admin</t></div>
        </t>
    </p>
</div>
            </field>
            <field name="report_template_ids" eval="[(4, ref('sale.action_report_pro_forma_invoice'))]"/>
            <field name="auto_delete" eval="True"/>
        </record>

        <record id="mail_template_sale_confirmation" model="mail.template">
            <field name="name">Sales: Order Confirmation</field>
            <field name="model_id" ref="sale.model_sale_order"/>
            <field name="subject">{{ object.company_id.name }} {{ (object.get_portal_last_transaction().state == 'pending') and 'Pending Order' or 'Order' }} {{ object.name or 'n/a' }}</field>
            <field name="email_from">{{ (object.user_id.email_formatted or object.company_id.email_formatted or user.email_formatted) }}</field>
            <field name="partner_to" eval="False"/>
            <field name="use_default_to" eval="True"/>
            <field name="description">Sent to customers on order confirmation</field>
            <field name="email_layout_xmlid">mail.mail_notification_layout_with_responsible_signature</field>
            <field name="body_html" type="html">
                <div style="margin: 0px; padding: 0px;">
                    <t t-set="color" t-value="object.company_id.email_secondary_color or '#875A7B'"/>
                    <t
                            t-if="'website_id' in object and object.website_id"
                            t-set="logo_src"
                            t-value="object.website_id.image_url(object.website_id, 'logo')"
                        />
                    <t t-else="" t-set="logo_src" t-valuef="/logo.png?company=#{object.company_id.id}"/>
                    <img t-att-src="logo_src" style="display: block; height: 50px; margin: 0 0 16px;" alt="Logo"/>
                    <p style="margin: 0 0 12px; padding: 0px; line-height: 18px; font-size: 14px;">
                        Hello <t t-out="object.partner_id.display_name or ''">Johnny Tester</t>,
                        <br/><br/>
                        <t t-set="tx_sudo" t-value="object.get_portal_last_transaction()"/>
                        Your order <span style="font-weight:bold;" t-out="object.name or ''">S00049</span>
                        <t t-if="object.state == 'sale' or (tx_sudo and tx_sudo.state in ('done', 'authorized'))">
                            has been confirmed.<br/>
                            Thank you for your trust.
                        </t>
                        <t t-elif="tx_sudo and tx_sudo.state == 'pending'">
                            is pending. It will be confirmed when the payment is received.
                            <t t-if="object.reference">
                                Your payment reference is <span style="font-weight:bold;" t-out="object.reference or ''"></span>.
                            </t>
                        </t>
                        <br/>
                        <t t-set="documents" t-value="object._get_product_documents()"/>
                        <t t-if="documents">
                            <br/>
                            <t t-if="len(documents)>1">
                                Here are some additional documents that may interest you:
                            </t>
                            <t t-else="">
                                Here is an additional document that may interest you:
                            </t>
                            <ul style="margin-bottom: 0;">
                                <t t-foreach="documents" t-as="document">
                                    <li style="font-size: 14px;">
                                        <a t-out="document.ir_attachment_id.name"
                                            t-att-href="object.get_portal_url('/document/' + str(document.id))"
                                            t-att-target="target"/>
                                    </li>
                                </t>
                            </ul>
                        </t>
                        <t t-if="not is_html_empty(object.user_id.signature)">
                            <div style="font-size: 14px; margin: 0 0 16px;"><t t-out="object.user_id.signature or ''">Mitchell Admin</t></div>
                        </t>
                    </p>
                    <t t-if="hasattr(object, 'website_id') and object.website_id">
                        <div style="margin: 0px; padding: 0px;">
                            <!-- The following loop is also used in the addons > sale > data > mail_template_data.xml file because we want the same layout. -->
                            <t t-foreach="object.order_line" t-as="line">
                                <t t-if="(not hasattr(line, 'is_delivery') or not line.is_delivery) and not line.combo_item_id">
                                    <table width="100%" style="max-width: 590px; font-size: 14px; border-collapse: collapse;" role="presentation">
                                        <tr>
                                            <td width="24%" style="max-width: 120px; padding: 0 10px 10px 0; vertical-align: top;">
                                                <img t-attf-src="/web/image/product.product/{{ line.product_id.id }}/image_128" t-attf-style="width: 64px; height: {{object.website_id and object.website_id._get_product_image_ratio_height() or '64px'}}; object-fit: cover; object-position: center;" alt="Product image"></img>
                                            </td>
                                            <td align="left" style="vertical-align: top; padding-bottom: 22px;">
                                                <h3 t-attf-style="mso-line-height-rule:exactly; margin:0; font-size: 14px; {{'margin-bottom: 6px;' if line.product_type == 'combo' else ''}}">
                                                    <strong t-out="line.product_id.name or ''" t-attf-style="color: #{color};">Taking care of Trees Course</strong>
                                                    <span t-if="line.product_id.product_template_attribute_value_ids" style="opacity: 0.5;">
                                                        <t t-out="', '.join(line.product_id.product_template_attribute_value_ids.mapped('name'))" />
                                                    </span>
                                                </h3>
                                                <t t-set="combo_line_idx" t-value="0"/>
                                                <t t-set="totalComboLines" t-value="0"/>
                                                <t t-set="line_idx" t-value="line_index"/>
                                                <t t-foreach="object.order_line" t-as="combo_liness">
                                                    <t t-if="(not hasattr(line, 'is_delivery') or not line.is_delivery) and (combo_liness.linked_line_id.id == line.id) and line_idx == line_index">
                                                        <t t-if="combo_liness.linked_line_id.id == line.id and combo_liness.id != line.id">
                                                            <t t-set="totalComboLines" t-value="totalComboLines + 1"/>
                                                        </t>
                                                    </t>
                                                </t>
                                                <t t-foreach="object.order_line" t-as="combo_line">
                                                    <t t-if="(not hasattr(line, 'is_delivery') or not line.is_delivery) and (combo_line.linked_line_id.id == line.id) and combo_line.combo_item_id and line_idx == line_index">
                                                            <t t-set="borderRadiusStyle" t-value="''"/>
                                                            <t t-set="borderTopStyle" t-value="''"/>
                                                            <t t-set="borderBottomStyle" t-value="''"/>

                                                            <t t-if="combo_line.linked_line_id.id == line.id and combo_line.id != line.id">
                                                                <t t-set="combo_line_idx" t-value="combo_line_idx + 1"/>
                                                            </t>
                                                            <t t-elif="combo_line.id == line.id and line_idx != line_index">
                                                                <t t-set="combo_line_idx" t-value="0"/>
                                                            </t>
                                                            <t t-if="combo_line_idx == 1">
                                                                <t t-if="totalComboLines != 1">
                                                                    <t t-set="borderRadiusStyle" t-value="'border-radius: 6px 6px 0 0;'"/>
                                                                    <t t-set="borderBottomStyle" t-value="'border-bottom: none;'"/>
                                                                </t>
                                                                <t t-else="">
                                                                    <t t-set="borderRadiusStyle" t-value="'border-radius: 6px;'"/>
                                                                </t>
                                                            </t>
                                                            <t t-elif="totalComboLines == combo_line_idx">
                                                                <t t-set="borderRadiusStyle" t-value="'border-radius: 0 0 6px 6px;'"/>
                                                                <t t-if="totalComboLines != 2">
                                                                    <t t-set="borderTopStyle" t-value="'border-top: none;'"/>
                                                                </t>
                                                            </t>
                                                            <div t-attf-style="width: 100%; border: 1px solid #dee2e6; padding: 5px 8px; {{ borderRadiusStyle }} {{ borderBottomStyle }} {{ borderTopStyle }}">
                                                                        <t t-out="combo_line.product_id.name or ''">Taking care of Trees Course</t>
                                                                        <span t-if="combo_line.product_id.product_template_attribute_value_ids" style="opacity: 0.5;">
                                                                            <t t-out="', '.join(combo_line.product_id.product_template_attribute_value_ids.mapped('name'))" />
                                                                        </span>
                                                                        -
                                                                        <span>
                                                                            <t t-out="int(combo_line.product_uom_qty) or ''">10000</t>
                                                                            <t t-out="combo_line.product_uom_id.name or ''" t-if="combo_line.order_id.create_uid._has_group('uom.group_uom')"></t>
                                                                        </span>
                                                                        <p t-if="hasattr(combo_line, 'is_rental') and combo_line.is_rental and combo_line.id == line.id" style="opacity: 0.7;">
                                                                            <t t-out="combo_line._get_rental_pricing_description() or ''"/><br/>
                                                                        </p>
                                                                        <t t-if="(hasattr(combo_line, 'is_rental') and combo_line.is_rental) or (hasattr(combo_line, 'event_id') and combo_line.event_id) or (hasattr(combo_line, 'calendar_event_id') and combo_line.calendar_event_id)">
                                                                            <t
                                                                                t-set="description_lines"
                                                                                t-value="combo_line.get_description_following_lines()"
                                                                            />
                                                                            <div t-if="description_lines" style="opacity: 0.7;">
                                                                                <t t-foreach="description_lines" t-as="description_line">
                                                                                    <p
                                                                                        t-if="description_line"
                                                                                        t-out="description_line"
                                                                                        style="margin: 4px 0 0;"
                                                                                    />
                                                                                </t>
                                                                            </div>
                                                                        </t>
                                                            </div>
                                                        </t>
                                                    <t t-elif="not(combo_line.linked_line_id) and combo_line.id == line.id">
                                                        <p t-if="hasattr(line, 'is_rental') and line.is_rental" style="margin: 4px 0 0; opacity: 0.7;">
                                                            <t t-out="line._get_rental_pricing_description() or ''"/><br/>
                                                        </p>
                                                        <t t-if="(hasattr(combo_line, 'is_rental') and combo_line.is_rental) or (hasattr(combo_line, 'event_id') and combo_line.event_id) or (hasattr(combo_line, 'calendar_event_id') and combo_line.calendar_event_id)">
                                                            <t
                                                                t-set="product_description_lines"
                                                                t-value="line.get_description_following_lines()"
                                                            />
                                                            <div t-if="product_description_lines" style="opacity: 0.7;">
                                                                <t t-foreach="product_description_lines" t-as="product_description_line">
                                                                    <p
                                                                        t-if="product_description_line"
                                                                        t-out="product_description_line"
                                                                        style="margin: 4px 0 0;"
                                                                    />
                                                                </t>
                                                            </div>
                                                        </t>
                                                    </t>
                                                </t>
                                                <span style="display: inline-block;  margin-top: 4px; padding: 4px 8px; border-radius: 20px; background-color: #e9ecef; color: #454748; font-size: 12px;">
                                                    <t t-out="int(line.product_uom_qty) or ''">10000</t>
                                                    <t t-out="line.product_uom_id.name or ''" t-if="line.order_id.create_uid._has_group('uom.group_uom')"></t>
                                                </span>
                                            </td>
                                            <td width="19%" align="right" style="max-width: 100px; vertical-align: top;">
                                                <t t-if="line.product_type == 'combo'">
                                                    <span t-out="format_amount(line._get_cart_display_price(), object.currency_id) or ''">$ 10.00</span>
                                                </t>
                                                <t t-else="">
                                                    <span style="white-space: nowrap;">
                                                        <t t-if="hasattr(object, 'website_id') and object.website_id.show_line_subtotals_tax_selection == 'tax_excluded'">
                                                            <t t-out="format_amount(line.price_subtotal, object.currency_id) or ''">$ 10.00</t>
                                                        </t>
                                                        <t t-else="">
                                                            <t t-out="format_amount(line.price_total, object.currency_id) or ''">$ 10.00</t>
                                                        </t>
                                                    </span>
                                                </t>
                                                <t t-if="hasattr(line, 'recurring_invoice') and line.recurring_invoice">
                                                    <br/>
                                                    <t t-out="line.subscription_plan_id.billing_period_display_sentence or ''"/>
                                                </t>
                                            </td>
                                        </tr>
                                    </table>
                                </t>
                            </t>
                        </div>
                        <div style="margin: 10px 0 16px; padding: 0px;">
                            <table width="100%" t-if="hasattr(object, 'carrier_id') and object.carrier_id" style="max-width: 590px; font-size: 14px; border-spacing: 0px 4px; white-space: nowrap;" role="presentation">
                                <tr>
                                    <td style="padding-top: 8px; width: 50%; border-top: 1px solid #dee2e6;" align="left">Delivery</td>
                                    <td style="padding-top: 8px; width: 50%; border-top: 1px solid #dee2e6;" align="right" t-out="format_amount(object.amount_delivery, object.currency_id) or ''">$ 0.00</td>
                                </tr>
                                <tr>
                                    <td style="width: 50%;" align="left">Untaxed Amount</td>
                                    <td style="width: 50%;" align="right" t-out="format_amount(object.amount_untaxed, object.currency_id) or ''">$ 10.00</td>
                                </tr>
                            </table>
                            <table width="100%" t-else="" style="max-width: 590px; opacity: 0.8; font-size: 14px; border-spacing: 0px 4px; white-space: nowrap;" role="presentation">
                                <tr>
                                    <td style="width: 50%; border-top: 1px solid #dee2e6;" align="left">Untaxed Amount</td>
                                    <td style="width: 50%; border-top: 1px solid #dee2e6;" align="right" t-out="format_amount(object.amount_untaxed, object.currency_id) or ''">$ 10.00</td>
                                </tr>
                            </table>
                            <t t-if="object.tax_totals and object.tax_totals['subtotals']">
                                <t t-set="all_tax_lines" t-value="[tax for line in object.tax_totals['subtotals'] for tax in line['tax_groups']]"/>
                                <table width="100%" t-if="all_tax_lines" style="max-width: 590px; font-size: 14px; border-spacing: 0px; white-space: nowrap;" role="presentation">
                                    <tr t-foreach="all_tax_lines" t-as="tax_line">
                                        <td style="width: 20%; padding-bottom: 8px;" align="left"><span t-out="tax_line['group_name']"/></td>
                                        <td style="width: 80%;" align="right" t-out="format_amount(tax_line['tax_amount_currency'], object.currency_id) or ''">$ 0.00</td>
                                    </tr>
                                </table>
                            </t>
                            <table width="100%" style="max-width: 590px; font-size: 14px; border-spacing: 0px; white-space: nowrap;" role="presentation">
                                <tr>
                                    <td style="width: 20%; padding-top: 4px; border-top: 1px solid #343a40; opacity: 0.9;" align="left"><strong>Total</strong></td>
                                    <td style="width: 80%; padding-top: 4px; border-top: 1px solid #343a40; font-weight: bold; " align="right">
                                        <span style="display: inline-block; margin-right: 4px; padding: 4px 8px; border: 1px solid #dee2e6; border-radius: 4px;">
                                            <span style="opacity: 0.9;">Paid with</span>
                                            <span t-attf-style="color: #{color}; font-weight: bold;">
                                                <t t-out="tx_sudo.provider_id.sudo().name or ''"></t>
                                            </span>
                                        </span>
                                        <span style="opacity: 0.9;"><t t-out="format_amount(object.amount_total, object.currency_id) or ''">$ 10.00</t></span>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <table t-if="object.partner_shipping_id and not object.only_services" width="295" style="vertical-align: top; font-size: 14px; margin-bottom: 12px;" align="left" role="presentation">
                            <tr>
                                <td style="padding-bottom: 4px; font-weight: bold;">
                                    <span style="opacity: 0.9;">Delivery with</span>
                                    <span t-attf-style="color: {{color}}; opacity: 1;"><t t-out="object.carrier_id.name or ''"></t></span>
                                </td>
                            </tr>
                            <tr>
                                <td style="opacity: 0.9;">
                                    <t t-out="object.partner_shipping_id.street or ''">1201 S Figueroa St</t><br/>
                                    <t t-out="object.partner_shipping_id.city or ''">Los Angeles</t>
                                    <t t-out="object.partner_shipping_id.state_id.name or ''">California</t>
                                    <t t-out="object.partner_shipping_id.zip or ''">90015</t><br/>
                                    <t t-out="object.partner_shipping_id.country_id.name or ''">United States</t>
                                </td>
                            </tr>
                        </table>
                        <table t-if="object.partner_invoice_id" width="295" style="vertical-align: top; opacity: 0.8; font-size: 14px;" align="left" role="presentation">
                            <tr>
                                <td style="padding-bottom: 4px;">
                                    <span style="font-weight:bold;">Billing</span>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <t t-out="object.partner_invoice_id.street or ''">1201 S Figueroa St</t><br/>
                                    <t t-out="object.partner_invoice_id.city or ''">Los Angeles</t>
                                    <t t-out="object.partner_invoice_id.state_id.name or ''">California</t>
                                    <t t-out="object.partner_invoice_id.zip or ''">90015</t><br/>
                                    <t t-out="object.partner_invoice_id.country_id.name or ''">United States</t>
                                </td>
                            </tr>
                        </table>
                    </t>
                </div>
            </field>
            <field name="report_template_ids" eval="[(4, ref('sale.action_report_saleorder'))]"/>
            <field name="auto_delete" eval="True"/>
        </record>

        <record id="mail_template_sale_payment_executed" model="mail.template">
            <field name="name">Sales: Payment Done</field>
            <field name="model_id" ref="sale.model_sale_order"/>
            <field name="subject">{{ object.company_id.name }} {{ (object.get_portal_last_transaction().state == 'pending') and 'Pending Order' or 'Order' }} (Ref {{ object.name or 'n/a' }})</field>
            <field name="email_from">{{ (object.user_id.email_formatted or user.email_formatted) }}</field>
            <field name="partner_to" eval="False"/>
            <field name="use_default_to" eval="True"/>
            <field name="description">Sent to customers when a payment is received but doesn't immediately confirm their order</field>
            <field name="email_layout_xmlid">mail.mail_notification_layout_with_responsible_signature</field>
            <field name="body_html" type="html">
<div style="margin: 0px; padding: 0px;">
    <p style="margin: 0px; padding: 0px; font-size: 12px;">
        <t t-set="transaction_sudo" t-value="object.get_portal_last_transaction()"/>
        Hello,
        <br/><br/>
        A payment with reference
        <span style="font-weight:bold;" t-out="transaction_sudo.reference or ''">SOOO49</span>
        amounting
        <span style="font-weight:bold;" t-out="format_amount(transaction_sudo.amount, object.currency_id) or ''">$ 10.00</span>
        for your order
        <span style="font-weight:bold;" t-out="object.name or ''">S00049</span>
        <t t-if="transaction_sudo and transaction_sudo.state == 'pending'">
            is pending.
            <br/>
            <t t-if="object.currency_id.compare_amounts(object.amount_paid + transaction_sudo.amount, object.amount_total) >= 0 and object.state in ('draft', 'sent')">
                Your order will be confirmed once the payment is confirmed.
            </t>
            <t t-else="">
                Once confirmed,
                <span style="font-weight:bold;" t-out="format_amount(object.amount_total - object.amount_paid - transaction_sudo.amount, object.currency_id) or ''">$ 10.00</span>
                will remain to be paid.
            </t>
        </t>
        <t t-else="">
            has been confirmed.
            <t t-if="object.currency_id.compare_amounts(object.amount_paid, object.amount_total) &lt; 0">
                <br/>
                <span style="font-weight:bold;" t-out="format_amount(object.amount_total - object.amount_paid, object.currency_id) or ''">$ 10.00</span>
                remains to be paid.
            </t>
        </t>
        <br/><br/>
        Thank you for your trust!
        <br/>
        Do not hesitate to contact us if you have any questions.
        <t t-if="not is_html_empty(object.user_id.signature)">
            <div>--<br/><t t-out="object.user_id.signature or ''">Mitchell Admin</t></div>
        </t>
    </p>
</div>
            </field>
            <field name="report_template_ids" eval="[(4, ref('sale.action_report_saleorder'))]"/>
            <field name="auto_delete" eval="True"/>
        </record>

    </data>
</odoo>
