我已经根据发票编号制作了只读计算的 URL 字段。它工作得很好,但我想只生成文本部分,例如 400:
<a href="https://external_site_invoice?num=400">400</a>
现在它将整个链接生成为文本,这非常难看
<a href="https://external_site_invoice?num=400">https://external_site_invoice?num=400</a>
我的 Odoo 字段是这样定义的...
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,)
如何在 Odoo 中定义 URL 的文本部分与链接不同?这是记录不充分还是不可能?
最佳答案
您可以在小部件定义中定义 文本 属性,如下所示:
<field name="field_with_url" widget="url" readonly="1" text="My own text"/>
问候
关于openerp - 如何在 Odoo widget=url 中定义不同的链接文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35311903/