Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to get value from selection field in Email Template

By
scot77844
on 3/24/15, 4:50 AM 754 views

Hi,

I am creating a template for a class (say sale.order), in which I have a selection field (state). While I am trying to fetch value of state using ${object.state}, I am getting the "key" but not the "value" of the selection field. How can I get the value of selection. Please kindly help me. Thanks in advance.


Regards,

Scot.


1
Ameera PP
On 11/1/16, 6:52 AM

you will get only key values here. You can check in the report if ${object.state} value is 'xxx' , then you can print XXX

0
SonnyV
On 3/24/15, 5:18 AM

Not sure on how to get the field_val. But a workaround could be using if statements
<code>
% if object.state in ('draft'):  draft

% endif % if object.state in ('paid'):  paid

% endif
</code>

Something like this should work. Although the only if statements in mail templates i could find at this moment are checking if the variables are set. But I figure this would work. I couldn't test this, as my mailserver on my testenv is not configured

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/24/15, 4:50 AM
Seen: 754 times
Last updated: 11/1/16, 6:52 AM