@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:
- Müşteri İlişkileri Yönetimi
- e-Commerce
- Muhasebe
- Envanter
- PoS
- Project
- MRP
Bu soru işaretlendi
949
Görünümler
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Üye Ol