Odoo Help


This community 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.


How to group by sales order line in sale order form?

on 6/6/13, 2:04 AM 1,786 views

In sale order form view,

How to group by sales order line, Group by on product or name

Any one have fixed this?

In sales order, I want to make group by sales order line on name,

Like in products tree view we group by product category.

Hope you get it

on 6/6/13, 3:14 AM
On 6/6/13, 6:44 AM

hi I created a report that a group category_id

import time

from report import report_sxw

class order(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(order, self).__init__(cr, uid, name, context=context)
            'time': time,


    def get_total(self,obj):

        query = """
        SELECT  category_id as category,SUM(price_unit * product_uom_qty) as price, SUM(nb_parcells) as parcells ,sum(th_weight * product_uom_qty) as poids
        FROM sale_order_line 
        WHERE order_id = %s GROUP BY category_id
        data = self.cr.dictfetchall()
        for t in data:
            req=self.pool.get('product.category').browse(self.cr, self.uid, t['category'])

            dict={'price' : t['price'],'parcells' : t['parcells'],'poids' : t['poids'],'category' : req.name}
        return res

report_sxw.report_sxw('report.liste.colisage.detail', 'sale.order', 'addons/tsale/report/colisage_detail.rml', parser=order, header="external")

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

hi Farid:

[[ repeatIn(get_total(o),'t') ]]

[[ (t['category']) ]] [[ (t['price']) ]] [[ (t['poids']) ]] [[ (t['parcells']) ]]

Not asked for report, In sales order form view -> order lines need to make group by.(one2many field)


on 6/6/13, 7:57 AM

Hello le_dilem. can you share rml file because how to use get_total in rml.

Farid Ghanchi
on 6/13/13, 8:27 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 6/6/13, 2:04 AM
Seen: 1786 times
Last updated: 3/16/15, 8:10 AM