@http.route('/products', type='json', auth='user')
def getallproduct(self):
products_rec = request.env['product.template'].search([])
products = []
for rec in products_rec:
vals = {
#'Reference Number': rec.default_code,
#'Product Name': rec.name,
#'quantity': rec.qty_available,
'location': rec.warehouse_id.name,
#'unit': rec.uom_id.name
}
products.append(vals)
print('Product List --->', products)
print('Total products is', len(products))
data = {'status': 200, 'response': products, 'message': 'Done All Products Returned'}
return data
when i test this api on POSTMAN,it displays, "location": false, but there are warehouse in my database. can you help me please??
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
942
Widoki
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj się