Skip to Content
Menu
This question has been flagged
2 Replies
6284 Views

Hi

please how to customize (add a new menu after quote) website portal sale template ? which method to use ?

i tried to add my code in the in website_portal_sale_templates.xml by copying existing code and modified it. but i get no change. :

<template id="portal_my_orders" name="My Sales Orders 1">
      <t t-call="website_portal.portal_layout">
        <h3 class="page-header">Your Orders 1</h3>
        <t t-if="not orders">
            <p>There are currently no orders for your account.</p>
        </t>
        <t t-if="orders">
            <table class="table table-hover o_my_status_table">
                <thead>
                  <tr class="active">
                    <th>numero #</th>
                    <th>numero 2 #</th>
                    <th>Order Date</th>
                    <th></th>
                    <th>Total</th>
                  </tr>
                </thead>
                <t t-foreach="orderrs" t-as="orderr">
                    <tr>
                        <td>
                            <a t-attf-href="/my/orderrs/{{orderr.id}}?{{keep_query()}}"><t t-esc="orderr.name"/></a>
                        </td>
                         <td>
                            <a t-attf-href="/my/orderrs/{{orderr.id}}?{{keep_query()}}"><t t-esc="orderr.id"/></a>
                        </td>
                        <td><span t-field="orderr.date_order"/></td>
                        <td>
                            <t t-if="orderr.state == 'progress'">
                                <span class="label label-info"><i class="fa fa-fw fa-clock-o"/> Invoiced</span>
                            </t>
                            <t t-if="orderr.state in ['shipping_except','invoice_except']">
                                <span class="label label-danger"><i class="fa fa-fw fa-warning"/> Problem</span>
                            </t>
                            <t t-if="orderr.state == 'done'">
                                <span class="label label-default"><i class="fa fa-fw fa-check"/> Done</span>
                            </t>
                        </td>
                        <td><span t-field="orderr.amount_total" t-options='{"widget": "monetary", "display_currency": order.pricelist_id.currency_id}'/></td>
                    </tr>
                </t>
            </table>
            <div t-if="pager" class="o_portal_pager text-center">
              <t t-call="website.pager"/>
            </div>
        </t>
      </t>
    </template>



Please help me.


regards

Avatar
Discard
Best Answer

The below code should is the xml code


<template id="new_link" name="New Link" inherit_id="website_portal.portal_layout" priority="25">
    <xpath expr="//ul[contains(@class,'o_portal_submenu')]" position="inside">
        <li>
            <a href="/my/newlink">New Menu</a>
        </li>
    </xpath>
</template>


The above code is used to create a new menu in the portal view of odoo 10. Also you want to create a new python function in the controller for creating the action. What to do on clicking on this new menu, with the link /my/newlink


For example

class CustomerPortal(CustomerPortal):

    @http.route(['/my/newlink', '/my/quotes/page/<int:page>'], type='http', auth="user", website=True)
    def portal_my_records(self, page=1, date_begin=None, date_end=None, sortby=None, **kw):
        
        print("IN PYTHON CONTROLLER")
        data={}
        return request.render("call.template", data)

When you click on the New menu in the portal page the python function will execute. and from here you can pass the controll to another template. in the above code call.template is the template name and data is the values that you need to pass into that particular template.


If you want to create a new menu in the portal page of odoo 11 refer the below link.

https://stackoverflow.com/questions/52733625/how-to-add-my-custom-menu-to-the-portal-users-menu-list



Avatar
Discard
Best Answer

typo orderr maybe. If you have an order as in <t t-if="orders"> you still have no orderr and nothing is displayed

Avatar
Discard
Related Posts Replies Views Activity
2
Sep 22
8421
2
Mar 17
10218
2
Aug 23
16329
1
Jan 23
825
5
Feb 24
22100