Skip to Content
Menu
This question has been flagged

Hi all, I am new to Odoo development.


The /my/orders route loads the sale.portal_my_orders template (and the first thing this template does is call the portal.portal_layout template). I have added an extra menu above the list of sales orders (see code below), but it also shows up on the /my/account route, which I don't want.

I've tried to find a solution with little success. I was able to use <t t-set="is_my_orders_page" t-value="true"> on the sale.portal_my_orders call for the orders page, then use <t t-if="is_my_orders_page"> to conditionally render the menu in my custom module. This does work, but I would rather find a solution where I don't modify any code outside of my custom module.


Templates in my custom module:

<template id="my_orders_menu" inherit_id="portal.portal_layout" active="True" name="My Orders Menu">
<xpath expr="//div[@id='wrap']" position="before">
<t t-if="is_my_orders_page">
<div class="d-flex justify-content-center">
<a href="#"> Pending Payment </a>
<a href="#"> Processing </a>
</div>
</t>
</xpath>
</template>


And the code I changed in sale.portal_my_orders:
<template id="portal_my_orders" name="My Sales Orders">
<t t-call="portal.portal_layout">
<t t-set="is_my_orders_page" t-value="True"/>
</t>
</template>

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 24
103
5
Jul 24
86817
1
Dec 23
1814
1
May 22
1819
0
Jan 20
2130