In sale order form view,
How to group by sales order line, Group by on product or name
Any one have fixed this?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
In sale order form view,
How to group by sales order line, Group by on product or name
Any one have fixed this?
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)
self.localcontext.update({
'time': time,
'get_total':self.get_total,
})
def get_total(self,obj):
res=[]
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
"""%(obj.id)
self.cr.execute(query)
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}
res.append(dict)
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)
:)
Hello le_dilem. can you share rml file because how to use get_total in rml.
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