@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
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
966
Lượt xem
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký