How to get orderlins in Pos Odoo 15
i want to get orderlins in Pos odoo 15
for example i have receipt like this
5 suger
6 flour
3 Rice
2 Oil
i want to get this field value ( Items Count = 4 )
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ờ
Hi,
Refer the app:
https://apps.odoo.com/apps/modules/16.0/pos_orderline_items_count/
This helps to show the items' count and total quantity of the pos order
Regards
Ksolves India Limited (Odoo Gold Partner)
thank you very much
do you mean that i shall add custom model and add 2 files ( init , another file of model ) inside it
and pu that code inside ?
Hi There!
To get the orderlines (i.e., the items on the receipt) in Odoo 15 Pos, you can use the following code:
pythonCopy code# Import the required modules from odoo import models, fields # Define your custom model to get the orderlines class PosOrderLine(models.Model): _inherit = 'pos.order.line' # Add a custom field to get the orderline count orderline_count = fields.Integer(compute='_get_orderline_count') def _get_orderline_count(self): for line in self: line.orderline_count = len(line.order_id.lines)
Now, you can access the orderline count from the Pos OrderLine model by using the orderline_count field.
pythonCopy code# Example Usage orderlines = self.env['pos.order.line'].search([('order_id', '=', order_id)]) orderline_count = orderlines.orderline_count
This will give you the count of items on the receipt.
Regards,
Ksolves!
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ýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 7 22
|
1325 | ||
|
1
thg 3 22
|
1752 | ||
|
4
thg 7 19
|
4816 | ||
|
0
thg 1 19
|
3034 | ||
|
0
thg 8 17
|
4083 |