Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1143 มุมมอง

I have this SQL query that displays the report of categories and the total quantity of the products sold in that category. I want to see which user has sold how many products, when I use the code below it only displays the total quantity sold for one product by the specific user. I have 2 products in the category that is sold by the user, but it displays only the quantity sold for one product.

elif data.get('report_type') == 'report_by_categories':

            user_id = res_users.id = %s

               AND sale_order.state = 'sale'  -- Filter for confirmed sales

               ''' % user_id

            if data.get('date_from'):

                query += "AND sale_order.date_order >= '%s' " % data.get('date_from')

            if data.get('date_to'):

                query += "AND sale_order.date_order

                

            query += "GROUP BY product_category.name"

            self._cr.execute(query)

            report_by_categories = self._cr.dictfetchall()

            report_sub_lines.append(report_by_categories)

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ม.ค. 24
4668
0
ก.ย. 19
2994
0
มี.ค. 15
3859
change a product category แก้ไขแล้ว
3
ก.พ. 24
12698
2
มี.ค. 15
4489