I would like to obtain list of stock quants grouped by product_id
this is my controller.py
from odoo import http, fields, models
class Academy(http.Controller):
@http.route('/page/stock/', auth='public', website=True)
def academy(self):
Connected_User = http.request.env.user.id
User_ID = http.request.env['res.users'].search([['id', '=', Connected_User]])
partner_id = User_ID.partner_id.id
Stock_Location = http.request.env['stock.location'].search([['partner_id', '=', partner_id]])
Stock_Location_ID = Stock_Location.id
Stock_Quants = http.request.env['stock.quant'].search([['location_id', '=', Stock_Location_ID]])
return http.request.render('academy.academy', {'quants': Stock_Quants})
Did you find this solution?