Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Email template is failed to render ? [SOLVED]

Subscribe

Get notified when there's activity on this post

This question has been flagged
v8sale.orderemail_template
4 Replies
33091 Views
Avatar
YOPI ANGI

Hello,

I define new process that will send the email automatically without through the wizard. 

I create new template (adapt from existing one), but when i send it, i check the email and the email i got is not supposed to be, the email is weird.

from the server is trace the log, they look like this:

 MissingError: ('MissingError', 'One of the documents you are trying to access has been deleted, please try again after refreshing.')
2015-02-17 05:44:08,316 1100 ERROR tes06 openerp.addons.email_template.email_template: Failed to render template <Template memory:7f76f8117bd0> using values {'format_tz': <function <lambda> at 0x7f76e8b8bc08>, 'ctx': {'default_use_template': True, 'lang': None, 'default_composition_mode': 'comment', 'default_template_id': 31, 'default_res_id': 56, 'mark_so_as_sent': True, 'default_model': 'sale.order', 'tpl_partners_only': True}, 'user': res.users(1,), 'object': account.invoice(56,)}

the email i got, is like this:

Hello ${object.partner_id.name},

We want to say thank you for your trusted to us.

Here the information about your sale order,

  REFERENCES
  Invoice number: ${object.number}
  Invoice total: ${object.amount_total} ${object.currency_id.name}
  Invoice date: ${object.date_invoice}
% if object.origin:   Order reference: ${object.origin}
% endif % if object.user_id:   Your contact: ${object.user_id.name} % endif

 

here my code:

@api.one

def action_mail_send(self):

mail_compose = self.env['mail.compose.message']

# get the template

template_id = self.so_paid_email_template()

# modify the context

ctx = dict()

ctx.update({ 'default_model': 'sale.order', 'default_res_id': self.ids[0], 'default_use_template': bool(template_id), 'default_template_id': template_id.id, 'default_composition_mode': 'comment', 'mark_so_as_sent': True, })

# compose message

new_message = mail_compose.with_context(ctx).create({ 'partner_ids': self.partner_id.email, 'body': template_id.body_html, })

# send

new_message.send_mail()

return True

 

Thank You,

0
Avatar
Discard
Avatar
YOPI ANGI
Author Best Answer

I think i solved it. :)

it's a simple solution, just load the email template and then sent it

example: 

template_id = self.env.ref('model.xml_id')

template_id.send_mail(self.ids[0], force_send=True)

 

2
Avatar
Discard
Murugan Chinnasamy

This is working good

Avatar
Joe BALANGA
Best Answer

Salut!! Je suis en train de créer un devis mais à chaque fois qu'il faut valider mon devis, Odoo m'envoit un message en disant que la ligne n'est pas défini. Alors je ne sais pas comment faire!

L'erreur en question :  Failed to render template : 'line' is undefined

0
Avatar
Discard
Avatar
Ruturaj Chavda
Best Answer

Hi ,Create a new custom module and write the same code. It works.

0
Avatar
Discard
Avatar
krishnakanth
Best Answer

Hi, Try this solution once as follows: If your rendering datetime field value: here object.cutoff_date is datetime field ${format_tz(object.cutoff_date, format= '%d/%b/%Y')} If Date field as follows: here object.cutoff_date is date field ${format_tz(object.cutoff_date+ ' 00:00:00', format= '%d/%b/%Y')}

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
How can I add custom fields to the sale order print template?
v8 print sale.order
Avatar
Avatar
Avatar
Avatar
3
Apr 22
13600
how to call email templates with a custom module Solved
v8 email_template selectable
Avatar
Avatar
Avatar
Avatar
4
Nov 19
14626
How to feeding a field with template by selecting a drop down list
v8 dropdownlist email_template
Avatar
0
Nov 18
5201
How to modify count total amount in sale order? [SOLVED] Solved
v8 sale.order override
Avatar
Avatar
Avatar
3
Jan 18
10019
is it possible to use QWeb template when define a email template?
v8 qweb email_template
Avatar
Avatar
1
Sep 16
4639
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now