我需要将 Odoo 中的一个菜单项链接到一个外部链接,但是这个外部链接是一个存储在模型中的字符串,它对每个用户都是不同的。我不确定如何在字段名称 url
的 eval
属性中对此进行编码。或者这可能吗?
<openerp>
<data>
<record id="open_retainer" model="ir.actions.act_url">
<field name="name">Pay Retainer</field>
<field name="type">ir.actions.act_url</field>
<field name="target">new</field>
<field name="url" eval="'some_url' if True else ''"/>
</record>
<menuitem
name="Pay Retainer"
id="menu_pay_retainer"
groups="base.group_portal"
action="open_retainer"
parent="portal.portal_orders"/>
</data>
</openerp>
最佳答案
您可以尝试通过单击用户屏幕中的按钮并重定向到特定的 url 来代替菜单。
您可以尝试以下操作:
return { 'type': 'ir.actions.act_url', 'url': your_url, 'nodestroy': True, 'target': 'new' }
其中 'your_url' 是为每个用户存储的 url 字符串。
关于python - 如何将 Odoo 中的菜单链接到计算的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33862933/