When creating a new product through the Python controller everything works well, except that the Track Inventory option is never selected. Without it, the available quantity is not shown on the product card.
I have tried this but it doesn't work:
product = (request.env["product.product"].sudo().create({ "name": product_name, "default_code": sku, "standard_price": cost_price, "list_price": sale_price, "weight": weight, "uom_id": uom_id, "categ_id": category_id, "image_1920": image, "type": "product", "tracking": "none" }))
When I try it with product template, it throws this error:
Wrong value for product.template.type: 'product'
I had also tried changing the product type to "consu" but the track inventory option still doesn't select.
Am I doing something wrong?
Hello Sofia,
You’re very welcome - glad it worked!
Yes, is_storable is mentioned in the documentation under field attributes, though it’s easy to miss. Happy to share the exact section if needed.
Feel free to reach out anytime — you can also email me at patelkunjan1319@gmail.com
Best regards,
Kunjan