I am trying to display all the user wise sale order of the current logged in user, but I have no idea how/what to enter in the search. You can refer my code below-
controllers.py code:
class saleOrder(http.Controller):
@http.route('/sale-order', type='http',auth='public',website=True)
def render_sale_order(self):
saleorders = http.request.env['sale.order'].sudo().search([])
return http.request.render('sale_portal.sale_order', {'saleorders': saleorders})
templates.xml code:
<template id="sale_order"name="Sale Order">
<t t-call="website.layout">
<div class="oe_structure">
<div class="container">
<center><h3>Your Sale Orders</h3></center>
<t t-foreach="saleorders" t-as="saleorder">
<a t-attf-href="/sale-order/my-order"class="btn btn-info">
<h4><spant-esc="saleorder.name"/></h4>
</a>
</t>
</div>
</div>
</t>
</template>
I was able to print the name of all the sale order, but I wanted to print only the sale order of the logged in user.
Any help is really appreciated.
Thanks!
Yes, but I did't understand
I can see everything under my account section but i want to redirect in the website menu button
How to get current logged in user in controller: http://learnopenerp.blogspot.com/2018/08/get-current-logged-in-user-id-in-odoo.html