Help

rendering email template to fields.Html?

Closed

The question has been closed for reason: off-topic or not relevant

by
Darius Martinkus
on 10/23/2015 09:49:20

Hello odoo community,

I was trying to render email template value to fields.Html

I created extension to sales.order module I have two fields i made a onchange function

Fields:

cover_letter=fields.Html('Cover Letter')
template_id=fields.Many2one('email.template', 'Use template'

Function:

@api.onchange('template_id')
def copy_cover_letter(self):
self.ct_cover_letter=self.template_id.body_htm

 

But when i choose template_id, cover_letter gets populated but values i get is with "Hello ${object.partner_id.name},"

Results

Hello ${object.partner_id.name},

Further to your recent email request I am pleased to provide a quotation for the design programme

and supply of your new wireless call system for the first phase extension at Merok House care home. I

am confident that the system designed meets the needs of both your business and those that you

care for.

_________________________________________________________________

But how do i get instead of "Hello ${object.partner_id.name}", something similar to this "Hello 12 Rockliffe Court - Broadacres Housing Associatio" ?
I Seen similar  functionality as on send quotation but not sure how to replicated same behaviour by just rendering template? to my custom field cover_letter=fields.Html('Cover Letter')?

Example:

Hello 12 Rockliffe Court - Broadacres Housing Associatio,

Further to your recent email request I am pleased to provide a quotation for the design programme

and supply of your new wireless call system for the first phase extension at Merok House care home. I

am confident that the system designed meets the needs of both your business and those that you

care for.

Any help and examples would be appreciated!



Avatar
Discard