Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
i want to know how many stockable product in the order
Odoo Techno Functionalist
Feel free to connect : firstname.lastname@example.org
Twitter:https://twitter.com/niyasraphyLinkedIn: https://www.linkedin.com/in/niyasraphy/FB:https://www.facebook.com/niyasraphy123Happy to help :)
If you are looking to display/get the no of the stock-able product in the sale order, you can add a compute field in the sale order model and compute the count into it.
stock_product_count = fields.Integer(string='Count', compute='get_pro_count')
@api.multidef get_pro_count(self): for rec in self: count = 0 for line in rec.order_line: if line.product_id.type == 'product': count += 1 rec.stock_product_count = count
raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: sale.order(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
Hope you have added the field in tree view also, you can update the code like this,
for rec in self:
count = 0
for line in rec.order_line:
if line.product_id.type == 'product':
count += 1
rec.stock_product_count = count
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.
Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.