Home > Mobile >  Put field's value on ahref
Put field's value on ahref

Time:03-08

everyone.

i added a field in res.partner called x_link

x_link = fields.Char(String="Link")

i want to add a buttom in portal_sidebar, with href = " value of x_link " .

Every partner has his own link that refers to another website account for exemple x_link of partner 1 contains facebook/jack x_link of partner 2 contains Exemple/David ... etc

i tried :

<a  t-attf-href = "{{o.res.partner.x_link}}" > My link</a>

and

<a  t-attf-href = "{{partner.x_link}}" > My link</a>

and

<a  t-attf-href = "{{res.partner.x_link}}" > My link</a>

and

<a  t-attf-href = "{{o.res.partner_id.x_link}}" > My link</a>

and

<a  t-attf-href = "{{partner_id.x_link}}" > My link</a>

and

<a  t-attf-href = "{{res.partner_id.x_link}}" > My link</a>

but i get error and when i tried :

<a  t-attf-href = "{{x_link}}" > My link</a> 

the page refresh but don't redirect me to the website that x_link contains Thanks for helping me

CodePudding user response:

I am sending you snippet that working for me for email link.

<a t-attf-href="mailto:{{res_company.email}}"><t t-esc="res_company.email"/></a>

So I see you already tried above quotes. So here in my example there is res_company variable can be accessible. So, Please check at your end that your which variable is accessible. Because as i see you tried with a different like o.res.partner_id and directly partner_id etc. So, please check appropriate variable that accessible. Above code is working. Let me know by comment if any more clarification need.


Thanks,

Nikunj

  • Related