Skip to Content
Menu
This question has been flagged
2 Replies
3456 Views

My Sale Confirmation Mail Template ist not working. I do get this error:


Fehler beim Erstellen der Vorlage <Template memory:7fb4f60dca58> mit den Werten {'format_date': <function MailTemplate._render_template.<locals>.<lambda> at 0x7fb4f6487840>, 'format_datetime': <function MailTemplate._render_template.<locals>.<lambda> at 0x7fb4f6487ea0>, 'format_amount': <function MailTemplate._render_template.<locals>.<lambda> at 0x7fb503bbdbf8>, 'format_duration': <function MailTemplate._render_template.<locals>.<lambda> at 0x7fb503bbdea0>, 'user': res.users(9,), 'ctx': {'lang': 'de_DE', 'tz': 'Europe/Berlin', 'uid': 9, 'allowed_company_ids': [1], 'template_id': 45, 'active_model': 'mail.template', 'active_id': 45, 'active_ids': [45], 'template_preview_lang': 'de_DE', 'safe': False}, 'object': sale.order(117,)} UndefinedError: 'loop' is undefined

How can I fix my template?


Thank you

Avatar
Discard

Please provide the necessary information (log entries, template code ...)

Author

My template code is:

<div style="font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;margin:0px;padding: 0px;">

<p style="margin:0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;padding: 0px; font-size: 12px;">

Hallo,

<br><br>

% set transaction = object.get_portal_last_transaction()

Ihre Bestellung <strong style="font-weight:bolder;">${object.name}</strong> amounting in <strong style="font-weight:bolder;">${format_amount(object.amount_total, object.currency_id)}</strong>

% if object.state == 'sale' or (transaction and transaction.state in ('done', 'authorized')) :

wurde bestätigt.<br>

Vielen Dank für Ihr Vertrauen!

% elif transaction and transaction.state == 'pending' :

steht aus. Diese wird bestätigt, sobald die Zahlung eingegangen ist.

% if object.reference:

Ihre Zahlungsreferenz ist <strong style="font-weight:bolder;">${object.reference}</strong>.

% endif

% endif

<br><br>

Zögern Sie nicht, uns zu kontaktieren, wenn Sie Fragen haben.

<br><br>

% if object.website_id:

</p>

% for line in object.order_line:

% if not line.is_delivery:

% if line.display_type == 'line_section':

% elif line.display_type == 'line_note':

% else:

% if object.user_id.has_group('account.group_show_line_subtotals_tax_excluded'):

% endif

% if object.user_id.has_group('account.group_show_line_subtotals_tax_included'):

% endif

% endif

% endif

% endfor

<table width="100%" style="border-collapse:collapse;color:#454748;font-size: 12px; border-collapse: collapse;">

<tbody><tr style="border-bottom:2px solid #dee2e6;">

<td width="18%"><strong style="font-weight:bolder;">Produkt</strong></td>

<td>&nbsp;</td>

<td><strong style="font-weight:bolder;">Menge</strong></td>

<td width="10%" align="center"><strong style="font-weight:bolder;">Preis</strong></td>

</tr><tr style="${loop.cycle('background-color:#f2f2f2', 'background-color: #ffffff')}"><td colspan="4"><strong style="font-weight:bolder;">${line.name}</strong></td><td colspan="4"><i>${line.name}</i></td><td style="width:150px;">

<img src="/web/image/product.product/${line.product_id.id}/image_128" style="border-style:none;vertical-align:middle;width:64px;height: 64px; object-fit: contain;" alt="Product image">

</td>

<td align="left">${line.product_id.name}</td>

<td>${line.product_uom_qty}</td><td align="right">${format_amount(line.price_reduce_taxexcl, object.currency_id)}</td><td align="right">${format_amount(line.price_reduce_taxinc, object.currency_id)}</td></tr></tbody></table>

% if object.carrier_id:

% else:

% endif

<table width="40%" style="border-collapse:collapse;color:#454748;font-size: 12px; border-spacing: 0px 4px;" align="right"><tbody><tr>

<td style="border-top:1px solid #dee2e6;" align="right"><strong style="font-weight:bolder;">Lieferdatum:</strong></td>

<td style="border-top:1px solid #dee2e6;" align="right">${format_amount(object.amount_delivery, object.currency_id)}</td>

</tr>

<tr>

<td width="30%" align="right"><strong style="font-weight:bolder;">Zwischensumme:</strong></td>

<td align="right">${format_amount(object.amount_untaxed, object.currency_id)}</td>

</tr><tr>

<td style="border-top:1px solid #dee2e6;" width="30%" align="right"><strong style="font-weight:bolder;">Zwischensumme:</strong></td>

<td style="border-top:1px solid #dee2e6;" align="right">${format_amount(object.amount_untaxed, object.currency_id)}</td>

</tr><tr>

<td align="right"><strong style="font-weight:bolder;">Mehrwertsteuer:</strong></td>

<td align="right">${format_amount(object.amount_tax, object.currency_id)}</td>

</tr>

<tr>

<td style="border-top:1px solid #dee2e6;" align="right"><strong style="font-weight:bolder;">Gesamtsumme:</strong></td>

<td style="border-top:1px solid #dee2e6;" align="right">${format_amount(object.amount_total, object.currency_id)}</td>

</tr>

</tbody></table>

<br>

% if object.partner_invoice_id:

% endif

% if object.partner_shipping_id and not object.only_services:

% if object.carrier_id:

% endif

% endif

<table width="100%" style="border-collapse:collapse;color:#454748;font-size: 12px;"><tbody><tr>

<td style="padding-top:10px;">

<strong style="font-weight:bolder;">Rechnung an:</strong>

${object.partner_invoice_id.street or ''}

${object.partner_invoice_id.city or ''}

${object.partner_invoice_id.state_id.name or ''}

${object.partner_invoice_id.zip or ''}

${object.partner_invoice_id.country_id.name or ''}

</td>

</tr>

<tr>

<td>

<strong style="font-weight:bolder;">Bezahlungsmethode:</strong>

% if transaction.payment_token_id:

${transaction.payment_token_id.name}

% else:

${transaction.acquirer_id.name}

% endif

(${format_amount(transaction.amount, object.currency_id)})

</td>

</tr><tr>

<td>

<br>

<strong style="font-weight:bolder;">Lieferung an:</strong>

${object.partner_shipping_id.street or ''}

${object.partner_shipping_id.city or ''}

${object.partner_shipping_id.state_id.name or ''}

${object.partner_shipping_id.zip or ''}

${object.partner_shipping_id.country_id.name or ''}

</td>

</tr><tr>

<td>

<strong style="font-weight:bolder;">Liefermethode:</strong>

${object.carrier_id.name}

% if object.carrier_id.fixed_price == 0.0:

(Free)

% else:

(${format_amount(object.carrier_id.fixed_price, object.currency_id)})

% endif

</td>

</tr></tbody></table>

% endif

<p style="margin:0px;font-size:13px;font-family:&quot;Lucida Grande&quot;, Helvetica, Verdana, Arial, sans-serif;"></p>

</div>

Where can I find the other necessary information?

Related Posts Replies Views Activity
1
Dec 24
154
0
Nov 24
63
2
Jul 24
697
0
Apr 24
551
3
Mar 24
579