Odoo Help


where does 'company_name' in email templates come from?

Alexander Soare
on 6/8/16, 5:34 AM 314 views

I'm trying to configure the sender name that is sent with emails to clients. In Settings > Technical > Email > Templates > Notification Email the template contains something like this:

% if ctx.get('actions'): % for action in ctx['actions']:

\\\$\{action\[\'title\'\]\}\\\\\&nbsp\;\%if\ cmp\(len\(ctx\[\'actions\'\]\)\,\ 1\)\ \=\=\ 1\ and\ cmp\(len\(ctx\[\'actions\'\]\)\,\ loop\.index\)\ \=\=\ 1\:\ \|\ \%\ endif\ \%\ endfor\ \%\ else\:\&nbsp\;\\

\Sent\ by\\\\&nbsp\;\%\ if\ ctx\.get\(\'website\_url\'\)\:\&nbsp\;\\

\\%\ endif\\$\{ctx\.get\(\'company\_name\'\)\}\\&nbsp\;\%\ if\ ctx\.get\(\'website\_url\'\)\:\&nbsp\;\\\\%\ endif\&nbsp\;\\



 % endif

I tried searching for 'company_name' under Settings > Technical > Database Structure > Fields and it doesn't exist. Where is it defined?

Further context: The name of my company under res.company is the registered legal name. I want to make sure that clients get our commercial name in  emails, which is different to our registered name.


Prakash Sharma

--Prakash Sharma--
| 2 1 4
Delhi, India
--Prakash Sharma--

I like to surround myself with brave, creative people.

My motivation for learning different technologies and algos drive me. I love challenges of a steep learning curve which I believe makes me a better learner. I have a strong desire to learn different technologies, which would enable me to become a full stack developer.

Prakash Sharma
On 6/8/16, 12:39 PM

company name is coming form this method  _notify_prepare_template_context in side  addons/mail/models/res_partner.py which is the company name of login user  company_name = user.company_id.name

def _notify_prepare_template_context(self, message):
# compute signature
signature = ""
if message.author_id and message.author_id.user_ids and message.author_id.user_ids[0].signature:
signature = message.author_id.user_ids[0].signature
elif message.author_id:
signature = "<p>-- <br/>%s</p>" % message.author_id.name
# compute Sent by
if message.author_id and message.author_id.user_ids:
user = message.author_id.user_ids[0]
user = self.env.user
if user.company_id.website:
website_url = 'http://%s' % user.company_id.website if not user.company_id.website.lower().startswith(('http:', 'https:')) else user.company_id.website
website_url = False
company_name = user.company_id.name
model_name = False
if message.model:
model_name = self.env['ir.model'].sudo().search([('model', '=', self.env[message.model]._name)]).name_get()[0][1]
record_name = message.record_name
tracking = []
for tracking_value in message.tracking_value_ids:
return {
'signature': signature,
'website_url': website_url,
'company_name': company_name,
'model_name': model_name,
'record_name': record_name,
'tracking': tracking,

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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/8/16, 5:34 AM
Seen: 314 times
Last updated: 6/8/16, 4:35 PM