Skip to Content
Odoo เมนู
  • ลงชื่อเข้าใช้
  • ทดลองใช้ฟรี
  • แอป
    การเงิน
    • ระบบบัญชี
    • ระบบการออกใบแจ้งหนี้
    • ระบบบัญชีรายจ่าย
    • ระบบการจัดการข้อมูลผ่านสเปรดชีต (BI)
    • เอกสาร
    • ระบบลงลายเซ็น
    การขาย
    • ลูกค้าสัมพันธ์
    • การขาย
    • POS ร้านค้า
    • POS ร้านอาหาร
    • ระบบสมัครสมาชิก
    • การเช่า
    การจัดการเว็บไซต์
    • เครื่องมือสร้างเว็บไซต์
    • ระบบการขายออนไลน์
    • บล็อก
    • ฟอรั่ม
    • ไลฟ์แชท
    • ระบบการอบรมออนไลน์
    ซัพพลายเชน
    • คลังสินค้า
    • ระบบการผลิต
    • PLM
    • ระบบการจัดซื้อ
    • การซ่อมบำรุง
    • ระบบจัดการคุณภาพ
    ทรัพยากรบุคคล
    • ข้อมูลพนักงาน
    • ระบบสรรหาบุคลากร
    • ระบบการลา
    • การประเมิน
    • ระบบการแนะนำพนักงาน
    • ระบบจัดการยานพาหนะ
    การตลาด
    • โซเชียลมาร์เก็ตติ้ง
    • การตลาดผ่านอีเมล
    • ระบบการตลาดผ่าน SMS
    • ระบบการจัดงานอีเวนต์
    • การตลาดแบบอัตโนมัติ
    • ระบบแบบสำรวจ
    การบริการ
    • โปรเจกต์
    • ระบบบันทึกเวลา
    • ระบบการจัดการบริการภาคสนาม
    • ระบบดูแลช่วยเหลือ
    • การวางแผน
    • การนัดหมาย
    ประสิทธิผล
    • ระบบแสดงความคิดเห็น
    • ระบบการอนุมัติ
    • ไอโอที
    • VoIP
    • คลังข้อมูล
    • WhatsApp
    แอปพลิเคชันของบุคคลที่สาม Odoo สตูดิโอ แพลตฟอร์มคลาวด์ของ Odoo
  • อุตสาหกรรม
    การค้าปลีก
    • ร้านขายหนังสือ
    • ร้านขายเสื้อผ้า
    • ร้านขายเฟอร์นิเจอร์
    • ร้านขายของชำ
    • ร้านขายฮาร์ดแวร์
    • ร้านขายของเล่น
    Food & Hospitality
    • บาร์และผับ
    • ร้านอาหาร
    • อาหารฟาสต์ฟู้ด
    • Guest House
    • ตัวแทนจำหน่ายเครื่องดื่ม
    • Hotel
    อสังหาริมทรัพย์
    • Real Estate Agency
    • บริษัทสถาปัตยกรรม
    • บริษัทรับเหมา
    • การจัดการอสังหาริมทรัพย์
    • การจัดสวน
    • สมาคมเจ้าของอสังหาริมทรัพย์
    ปรึกษา
    • สำนักงานบัญชี
    • Odoo พาร์ทเนอร์
    • เอเจนซี่การตลาด
    • สำนักงานกฎหมาย
    • บริการสรรหาบุคลากร
    • การตรวจสอบและการรับรอง
    ระบบการผลิต
    • Textile
    • เหล็ก
    • เฟอร์นิเจอร์
    • อาหาร
    • Brewery
    • ของขวัญขององค์กร
    สุขภาพ & ฟิตเนส
    • ชมรมกีฬา
    • ร้านขายแว่นตา
    • ฟิตเนส
    • ผู้ประกอบวิชาชีพด้านสุขภาพ
    • ร้านขายยา
    • ร้านทำผม
    Trades
    • ช่างซ่อม
    • ฮาร์ดแวร์และการสนับสนุนด้านไอที
    • ระบบพลังงานแสงอาทิตย์
    • ช่างทำรองเท้า
    • บริการทำความสะอาด
    • HVAC Services
    อื่น ๆ
    • Nonprofit Organization
    • สำนักงานสิ่งแวดล้อม
    • ร้านเช่าป้ายโฆษณา
    • การถ่ายภาพ
    • ร้านเช่าจักรยาน
    • ตัวแทนจำหน่ายซอฟต์แวร์
    Browse all Industries
  • คอมมูนิตี้
    ศึกษา
    • บทเรียน
    • เอกสารกำกับโปรแกรม
    • การรับรอง
    • การฝึกอบรม
    • บล็อก
    • พอดแคสต์
    เพิ่มศักยภาพให้กับการศึกษา
    • โปรแกรมการศึกษา
    • Scale Up! Business Game
    • เยี่ยมชม Odoo
    รับซอฟต์แวร์
    • ดาวน์โหลด
    • เปรียบเทียบรุ่น
    • เผยแพร่
    ทำงานร่วมกัน
    • Github
    • ฟอรั่ม
    • ระบบการจัดงานอีเวนต์
    • การแปล
    • ร่วมเป็นพาร์ทเนอร์
    • Services for Partners
    • ลงทะเบียนเพื่อสร้างบัญชีบริษัทของคุณ
    รับบริการ
    • ค้นหาพาร์ทเนอร์
    • ค้นหานักบัญชี
    • พบกับที่ปรึกษา
    • บริการติดตั้งระบบเพื่อใช้งาน
    • ข้อมูลอ้างอิงลูกค้า
    • การสนับสนุน
    • อัปเกรด
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    รับการสาธิต
  • ราคา
  • ช่วยเหลือ

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

  • ลูกค้าสัมพันธ์
  • e-Commerce
  • ระบบบัญชี
  • สินค้าคงคลัง
  • PoS
  • โปรเจกต์
  • MRP
All apps
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

Failed to render template %r using values %r - Odoo v9 community

ติดตาม

รับการแจ้งเตือนเมื่อมีกิจกรรมในโพสต์นี้

คำถามนี้ถูกตั้งค่าสถานะ
emailingemail_templatewebsiteodooV9
4942 มุมมอง
อวตาร
Alberto

I have this model:

@api.one
def send_mail_function_model(self):
    template_id = self.env.ref('opencloud_cashflows.email_template_loan') #self.pool('email.template') self.env.ref
    if template_id:
        template_id.send_mail(self.id, force_send=True) #self.ids[0], force_send=True
    return True

Which I call from this controller:

class Loan(http.Controller):
@http.route(['/request_loan'], type='http', auth='user', website=True)
def send_mail_function(self, **kw):
    if request.env.uid != request.website.user_id.id:
        request.env.user.send_mail_function_model()
    return request.website.render('opencloud_cashflows.request_loan')

This is the javascript file:

odoo.define('opencloud_cashflows.opencloud_cashflows', function (require) { "use strict";
var ajax = require('web.ajax');
var core = require('web.core');
var website = require('website.website');
var _t = core._t;
var Model = require('web.Model');
$('.send_mail_function').on('click', function (){
    var model = new Model('res_users');
    $('send_mail_function_model').click(function(){
        model.call('send_mail_function_model',[])

    })
});
});

The email template:

<?xml version="1.0" ?>
<openerp>
<data noupdate="0">
    <!--Email template -->
    <record id="email_template_loan" model="mail.template">
        <field name="name">Loan - Send by Email</field>
        <field name="email_from"><![CDATA[${object.company_id.name} <${(object.company_id.email or user.email)|safe}>]]></field>
        <field name="email_to">${(object.company_id.loan_email and '%s &lt;%s&gt;' % (object.company_id.name, object.company_id.loan_email) or '')|safe}</field>
        <field name="subject">${object.company_id.name} Pedido de préstamo desde blinking.cl</field>
        <!--<field name="partner_to">${object.partner_id.id}</field>-->
        <field name="model_id" ref="model_cashflow_report"/>
        <field name="auto_delete" eval="True"/>
        <field name="lang">${object.env.user.lang}</field>
        <field name="body_html"><![CDATA[
        <div style="font-family: 'Lucida Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<center><img src="http://www.blinking.cl/images/blinking-img-redes.jpg"></img></center>
<p>Hola ${object.partner_id.bank},</p>
<br/>
<p>Requerimos la siguiente cantidad como préstamo ${object.field_total},</p>
<br/>
<p>Por favor cualquier duda comuniquese con nuestro teléfono ${object.company_id.phone},</p>
<br/>
<p>Muchas Gracias</p>
        ]]></field>
    </record>
</data>
</openerp>

The view I'm calling from the controller:

    </template>
    <template id="request_loan" name="Loan">
        <t t-call="website.layout">
          <div id="wrap">
            <div class="oe_structure"/>
            <div class="container">
                <h1>¡Gracias!</h1>
                <div class="row">
                    <div class="col-md-8">
                        <div class="alert alert-success">
                            Tu pedido se ha enviado satisfactoriamente.
                            <button type="button" class="close" data-dismiss="alert">&amp;times;</button>
                        </div>
                        <!--<p>
                            We will get back to you shortly.
                        </p>--><p class="mt64">
                            If you have an emergency, do not hesitate to contact us by phone:
                        </p>
                        <ul class="list-unstyled">
                            <li><i class="fa fa-phone"></i> : <span t-field="res_company.phone"/></li>
                            <li><i class="fa fa-envelope"></i> : <span t-field="res_company.email"/></li>
                        </ul>
                        <a href="/cashflows/"><span class="btn btn-primary btn-lg" style="margin-left:560px; margin-top:-70px; background-color:#e67e22;">Volver</span></a>
                    </div>
                    <div class="col-md-4">
                        <t t-call="website.company_description"/>
                    </div>
                </div>
            </div>
            <div class="oe_structure"/>
          </div>
        </t>
    </template>

And the button from which I call the function:

<center><a href="/request_loan"><button id="send_mail_function" class="btn btn-primary btn-lg" name="send_mail_function" value="Pedir préstamo al Banco" type="submit" style="background-color:#e67e22;" >Pedir préstamo al Banco</button></a></center>

It seems to be working fine though, besides the fact that it cannot render the email template, every time I click on the button it throws me this:

Traceback (most recent call last):
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/website/models/ir_http.py", line 242, in _handle_exception
response = super(ir_http, self)._handle_exception(exception)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/base/ir/ir_http.py", line 158, in _handle_exception
return request._handle_exception(exception)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 786, in _handle_exception
return super(HttpRequest, self)._handle_exception(exception)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/base/ir/ir_http.py", line 183, in _dispatch
result = request.dispatch()
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 845, in dispatch
r = self._call_function(**self.params)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 321, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 314, in checked_call
result = self.endpoint(*a, **kw)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 964, in __call__
return self.method(*args, **kw)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 514, in response_wrap
response = f(*args, **kw)
File "/home/kristian/odoov9/danisan/opencloud_cashflows/controllers/main.py", line 1017, in send_mail_function
request.env.user.send_mail_function_model()
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 425, in new_api
result = [method(rec, *args, **kwargs) for rec in self]
File "/home/kristian/odoov9/danisan/opencloud_cashflows/models/res_users.py", line 27, in send_mail_function_model
template_id.send_mail(self.id, force_send=True) #self.ids[0], force_send=True
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/mail/models/mail_template.py", line 537, in send_mail
values = self.generate_email(res_id)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/mail/models/mail_template.py", line 470, in generate_email
post_process=(field == 'body_html'))
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/mail/models/mail_template.py", line 367, in render_template
raise UserError(_("Failed to render template %r using values %r")% (template, variables))
UserError: (u"Failed to render template <Template memory:7fb8f2abf050> using values {'format_tz': <function <lambda> at 0x7fb8f03b0668>, 'ctx': {'lang': u'es_CL', 'tz': u'America/Santiago', 'safe': True, 'website_id': 1, 'uid': 1}, 'user': res.users(1,), 'object': cashflow.report(1,)}", None)

I've read somewhere that it has to do with the default language set up in the database, or user, and on some other post someone says that it is due to the gmail smtp server (which I have configured as smtp server in my odoo instance)

Any ideas?


0
อวตาร
ละทิ้ง
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!

ลงชื่อ
Related Posts ตอบกลับ มุมมอง กิจกรรม
Email send from website page - Odoo v9 community แก้ไขแล้ว
email_template website websites odooV9
อวตาร
อวตาร
1
พ.ค. 17
3613
Send email from website button using javascript on Odoo v9 community แก้ไขแล้ว
models email_template website odooV9 JavascriptCallFromOdoo
อวตาร
อวตาร
1
พ.ค. 17
6311
how to modify / set language for "send message" email in project task?
emailing emailtemplate email_template
อวตาร
0
มิ.ย. 23
2994
Custom Model show on Website แก้ไขแล้ว
models website odooV9
อวตาร
อวตาร
1
ต.ค. 16
7412
Extra Info Step in eCommece v9 แก้ไขแล้ว
ecommerce website odooV9
อวตาร
อวตาร
1
มิ.ย. 16
4965
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • Github
  • Runbot
  • การแปล
บริการ
  • โฮสติ้ง odoo.sh เซิร์ฟเวอร์
  • การสนับสนุน
  • อัปเกรด
  • การพัฒนาที่กำหนดเอง
  • การศึกษา
  • ค้นหานักบัญชี
  • ค้นหาพาร์ทเนอร์
  • ร่วมเป็นพาร์ทเนอร์
เกี่ยวกับเรา
  • บริษัทของเรา
  • ทรัพย์สินในรูปของเครื่องหมายการค้า
  • ติดต่อเรา
  • งาน
  • ระบบการจัดงานอีเวนต์
  • พอดแคสต์
  • บล็อก
  • ลูกค้า
  • กฎหมาย • ความเป็นส่วนตัว
  • ความปลอดภัย
الْعَرَبيّة 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 เป็นชุดแอปธุรกิจแบบเปิดที่ครอบคลุมทุกความต้องการของบริษัทของคุณ อาธิ CRM eCommerce ระบบบัญชี ระบบสินค้าคงคลัง ระบบการขายหน้าร้าน โปรเจกต์ และ อีกมากมาย

ความเหนือกว่าอันเป็นเอกลักษณ์ของ Odoo คือการใช้งานที่ง่ายดายและผสานการทำงานอย่างสมบูรณ์แบบในเวลาเดียวกัน

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