Reputation: 428
I have made read only computed URL-field based on invoice number. It works nicely but I would like to produce text part only itself like 400:
<a href="https://external_site_invoice?num=400">400</a>
Now it's producing whole link as text which is quite ugly
<a href="https://external_site_invoice?num=400">https://external_site_invoice?num=400</a>
My Odoo fields are defined this way...
ext_invoice_number= fields.Integer(string="Ext number")
def _showlink(self):
for rec in self:
if rec.ext_invoice_number:
if rec.ext_invoice_number>0:
rec.ext_link="https://external site/invoice?num=%d" % (rec.ext_invoice_number,)
ext_link = fields.Char(string="Link",compute=_showlink,)
How can I define text part of URL in Odoo to be different than link? This is poorly documented or it's not possible?
Upvotes: 5
Views: 5347
Reputation: 106
you can define the text attribute in widget definition like that:
<field name="field_with_url" widget="url" readonly="1" text="My own text"/>
Regards
Upvotes: 9