This question has been flagged

Hello,

I created a mail template to explain to an employee why his leave was refused, but,when the mail is sent ...there is no explanation in it.

Here's my field, which is not empty (fill with a default function):

'refusal_explanation': fields.text('Refusal Explanation'), 

and here's my template:

<record id="email_template_conge_refused" model="email.template">
<field name="name">leave state - Refused</field>
<field name="email_from">openerp@cesbron.com</field>
<field name="subject">[what you asked] - Refused</field>
<field name="email_to">${object.employee_id.work_email}</field>
<field name="auto_delete" eval="True"/>
<field name="model_id" ref="cesbron_hr13.model_hr_holidays"/>
<field name="body_html"><![CDATA[
<p>Hello</p>
<p> Your leave from ${object.date_from} to ${object.date_to} was modified by your superior.</p>
<p> The state is now "REFUSED"!!</p>
 
<p>Explanation: ${object.refusal_explanation}</p>

<p>best regards,</p>
<p>${object.employee_id.parent_id.name}</p>
]]></field>
</record>

I know there is something in refusal_explanation, "you didn"t say please", but the result is:

Hello

your leave from .............

the state is now "REFUSED!!"

explanation:                          <= and here should be write "you didn't say please"

best regards

some name.


My field is in the current object and is not empty that's why i don't understand why it doesn't apear in the mail ( I tried with a fields.char too....didn't work)

Someone can explain me why or what can I do to resolve my problem ?


Avatar
Discard

You have added the field to hr.holidays model right? Have you checked without default function? I mean by entering some text manually? May be problem with default function.

Author

Yeah I tried manually too, and I have the same result. I can see my field content in the view, but not in the mail ...

If you are trying to set a template for employee holiday table, then the model used is wrong. ()

Go to Settings --> Technical --> Email --> Template, Open your record, and check your value with Dynamic value builder and Preview in it.

Author

No it's the right model ... thanks to your advices, it seems to be an other issue...the line "explanation:${object.refusal_explanation}" doesn't want to be added to my template ... so i deleted all my templates and re-update them ...and it still don't work >.

Author

OK i found my problem ...there was a "noupdate="1" "at the start of my file ... that's why the update wasn't done... how did i Miss that thing ...